Click here to Skip to main content
15,909,332 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I deploy six java program in linux server,some was killed. I know that I can use the command grep "Killed process" /var/log/messages to find which process killed by the linux-kernel.But how can I find that the pid belong to my java program.It may be belong to other java program in the same server.The result is:
Aug 21 17:05:22 TEST_SERVER kernel: Killed process 2403, UID 700, (java)   total-vm:19970440kB, anon-rss:7472436kB, file-rss:356kB
Aug 21 17:05:22 TEST_SERVER kernel: Killed process 2405, UID 700, (java)    total-vm:19970440kB, anon-rss:7472456kB, file-rss:212kB
Aug 21 17:05:22 TEST_SERVER kernel: Killed process 2511, UID 800, (oracle) total-vm:26509852kB, anon-rss:48836kB, file-rss:4992488kB


What I have tried:

I know that use cd /proc/{pid} can find the pid detail,but now my process was killed, and I use the command it says can not find the file or catalog. I also look at the messages,but still nothing to do.
Out of memory: Kill process 2403 (java) score 114 or sacrifice child
Aug 21 17:05:22 TEST_SERVER kernel: Killed process 2403, UID 700, (java)     total-vm:19970440kB, anon-rss:7472436kB, file-rss:356kB
Aug 21 17:05:22 TEST_SERVER kernel: java invoked oom-killer: gfp_mask=0x201da,  order=0, oom_adj=0, oom_score_adj=0
Aug 21 17:05:22 TEST_SERVER kernel: java cpuset=/ mems_allowed=0
Aug 21 17:05:22 TEST_SERVER kernel: Pid: 22393, comm: java Not tainted 2.6.32-504.el6.x86_64 #1
Posted
Updated 24-Aug-18 23:46pm

1 solution

It would not help much to know which programmes has been killed. The processes are selected by the OOM killer due to internal decisions.

If you suspect some processes to consume too much memory you can check the memory usage in regular intervals manually or using a monitoring tool.

You might also disable overcommitment. Then processes allocating memory will fail much earlier. However, this may happen again to any process but processes requesting large blocks of memory should be affected more frequent.

If all processes work as intended, all you can do is providing more RAM or enable / increase the swap memory (which might result in bad performance).

Some links:
Out of memory: Kill process or sacrifice child – Plumbr[^]
How to Configure the Linux Out of Memory Killer[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900