当前位置:网站首页>Record the problem location experience when an application is suddenly killed
Record the problem location experience when an application is suddenly killed
2022-06-24 07:09:00 【Si Ye】
The problem background : Start the local application at one time , Automatically exit after two minutes , No abnormal conditions were found in the log , Inexplicable applications are automatically killed ;
Solutions :
1、linux adopt top see java Application memory and cpu It's not high , It just disappeared after a while ;
2、 No abnormality is found in the application log , The code has been checked several times ;
3、 adopt dmesg | grep java View kernel log information , Found the problem , as follows :
[16949523.941194] java invoked oom-killer: gfp_mask=0xd0, order=0, oom_score_adj=991 [16949523.942914] java cpuset=73a35980233979bb67f20700c76d77805de6ced7cfd18de836238a7bdae7c1dd mems_allowed=0 [16949523.942918] CPU: 4 PID: 310033 Comm: java Tainted: G U O 3.10.107-1-tlinux2_kvm_guest-0052 #1 [16949523.971234] Memory cgroup out of memory: Kill process 310033 (java) score 1964 or sacrifice child [16949523.973103] Killed process 182650 (java) total-vm:16705124kB, anon-rss:2079844kB, file-rss:22020kB
From the above information, you can see that the memory overflow is linux Killed java Application information ;
4、 But the memory usage of my application is not very high , adopt jinfo -flags <javapid> Find out java The pre application memory for application startup has reached 10G;
5、 adopt free perhaps vmstat Check that the remaining memory size is only 10G 了 , The kernel has detected that the system is out of memory 、 The process of selecting and killing a process can refer to the kernel source code linux/mm/oom_kill.c, When the system is low on memory ,out_of_memory() Be triggered , And then call select_bad_process() Select a “bad” Process kill , How to judge and choose a “bad” What about the process , You can't choose at random ? The selection process consists of oom_badness() decision , The algorithms and ideas selected are very simple and simple : most bad The process that uses the most memory is the process that uses the most memory .
6、oom_kill.c You can see in the code oom_badness() Rate each process , according to points To determine which process to kill , This points According to adj Adjust the ,root The process of permissions is often considered important , Should not be killed easily , So when scoring, you can get 3% Concession (adj -= 30; The lower the score, the less likely it is to be killed ). We can manipulate each process in user space oom_adj Kernel parameters to determine which processes are not so easy to be OOM killer Select kill . such as , If not MySQL If the process is easily killed, you can find MySQL After the running process number , adjustment oom_score_adj by -15( Be careful points The smaller it is, the less likely it is to be killed )
7、oom_score_adj Set value range -1000 To 1000 Range interval , Setting example : When an application memory request is used 1G when , Set up oom_score_adj=-500 when , actual linux You will think that this application only uses 500M, There will be a discount mechanism ; To ensure that some important applications are not accidentally kill fall ;
边栏推荐
- Go operation SQLite code error
- FreeRTOS MPU makes the system more robust!
- Unexpected token u in JSON at position 0
- Oceanus kudu sink summary
- How long does the domain name filing take and what materials need to be prepared
- What is the main function of cloud disk? How to restore deleted pictures
- Multi sensor fusion track fusion
- Spark parameter tuning practice
- Record -- about the problem of garbled code when JSP foreground passes parameters to the background
- Spark项目打包优化实践
猜你喜欢

C language student management system - can check the legitimacy of user input, two-way leading circular linked list

Programmers use personalized Wallpapers

You have a chance, here is a stage

Unexpected token u in JSON at position 0

Computing power and intelligence of robot fog

With a goal of 50million days' living, pwnk wants to build a "Disneyland" for the next generation of young people
![[binary tree] - middle order traversal of binary tree](/img/93/442bdbecb123991dbfbd1e5ecc9d64.png)
[binary tree] - middle order traversal of binary tree

leetcode:1856. Maximum value of minimum product of subarray

leetcode:84. The largest rectangle in the histogram
![[JUC series] completionfuture of executor framework](/img/d0/c26c9b85d1c1b0da4f1a6acc6d33e3.png)
[JUC series] completionfuture of executor framework
随机推荐
JVM调试工具-jstack
Laravel文档阅读笔记-Laravel Str slug() Function Example
Why does the remote end receive a check-out notice when the TRTC applet turns off audio and video locally
十年
Spark累加器和廣播變量
1. go deep into tidb: see tidb for the first time
FreeRTOS MPU makes the system more robust!
文件系统笔记
FreeRTOS MPU使系统更健壮!
在js中正则表达式验证小时分钟,将输入的字符串转换为对应的小时和分钟
智能视觉组A4纸识别样例
Oracle SQL comprehensive application exercises
Brief introduction of domain name registration
为什么要用lock 【readonly】object?为什么不要lock(this)?
Page Jump and database connection of student management system
Cloudcompare & PCL point cloud clipping (based on clipping box)
JVM debugging tool -jvisualvm
Tencent host security captures Yapi remote code execution 0day vulnerability for wild exploitation. The attack is spreading and can be intercepted by firewall
Bay area enterprises quick look! The focus of the data regulations of Shenzhen Special Economic Zone just released is coming!
0 foundation a literature club low code development member management applet (4)