out of memory in linux controlling which program dies

Dean Hiller asked:

We are running a job where we know it squeezes the memory sometimes a bit too much. This however is resulting in killing one or two processes that we want to be the last processes killed in such a situation. How do we tell linux, please please do not kill pid XXXX and pid YYY and kill the other jobs first including that job taking up all the CPU if necessary as that job(the one we are running) is lower priority for survival than the two other processes.

Basically we are running a map/reduce job with our cassandra database and linux is deciding to kill cassandra instead of killing map/reduce tasks(which would be ideal since they have recovery built in and can black list tasks as well).

My answer:


If you want the process that triggered the OOM to die, just set the appropriate sysctl:

vm.oom_kill_allocating_task=1

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.