Linux kills a process when when starving memory

I recently observed a rather strange problem with randomly dying Java processes under heavy load. The vital clue to this problem was hidden in /var/log/messages as shown below:

Feb 1 12:26:31 mysuperserver kernel: Out of memory: Kill process 30595 (java) score 252 or sacrifice child
Feb 1 12:26:31 mysuperserver kernel: Killed process 30595 (java) total-vm:13698324kB, anon-rss:8226564kB, file-rss:0kB, shmem-rss:0kB

It turns out that Linux may decide to kill a process when the system runs out of memory. It may make sense to cap the memory limit (-Xmx) of any Java processes running on the system to a value that sums up below the server’s available memory.

Jaan Angerpikk explained this problem in great detail, follow the link below to read more on this matter.

https://plumbr.eu/blog/memory-leaks/out-of-memory-kill-process-or-sacrifice-child

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.