Read more

Help me, there is a zombie process!

Kim Klotz
June 21, 2013Software engineer at makandra GmbH

Here Show archive.org snapshot is a good explanation for zombie processes.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Quote:

If you have zombie processes it means those zombies have not been waited for by their parent (look at PPID displayed by ps -l). 
You have three choices: Fix the parent process (make it wait); kill the parent; or live with it.
Remember that living with it is not so hard because zombies take up little more than one extra line in the output of ps.

On a server I want to get informed if there are zombie processes and track them with a Icinga check. That's the reason why I want to get rid of them.

Example to get rid of the zombies (in this example there are some python zombie processes):

  1. Get PPID of zombie process:

     $ ps -ef | grep "python"
     [...]
     nova     13930  1543  0 Jun19 ?        00:00:00 [python] <defunct>
     nova     13931  1543  0 Jun19 ?        00:00:00 [python] <defunct>
     nova     13932  1543  0 Jun19 ?        00:00:00 [python] <defunct>
     nova     13933  1543  0 Jun19 ?        00:00:00 [python] <defunct>
     nova     13934  1543  0 Jun19 ?        00:00:00 [python] <defunct>
     nova     13935  1543  0 Jun19 ?        00:00:00 [python] <defunct>
     # PPID of all the zombie processes is 1543
    
  2. Find the Parent process:

     $ ps -ef | grep 1543
     [...]
     nova      1543     1  0  2012 ?        00:19:37 python /usr/bin/nova-novncproxy --flagfile=/etc/nova/nova.conf --web /usr/share/novnc/
    

Now you have the two choices, fix it or kill it. In this case it's no critical service and I can just restart it.

Posted by Kim Klotz to makandra dev (2013-06-21 13:24)