tryl

  • Recent Entries
  • Archive
  • Friends
  • User Info

Sat, Mar. 6th, 2010, 09:57 pm
zombie processes

Let's say you've been monitoring your system and you've found a zombie process, what can you do about it? The first thing to do is find out which process is the parent of the zombie. You can do this by running the command

ps axo stat,ppid,pid,cmd | grep ^Z

The output will show you all zombie processes on the system with the ID number of their parent in the second column. We can then remind the parent that they have zombie children running wild by sending them a signal. Let's say that the parent process ID is 12889, for example. We could remind this process to collect its child's death certificate by running

kill -SIGCHLD 12889

However, if the parent refuses to handle the signal and collect the child's data, then we have to choose between leaving a zombie in the system and killing the parent process. When a parent process dies, any children it has are turned over to the init service. The init service regularly checks the status of its children and collects any death certificates, removing zombies from the system. We can try killing the parent nicely by asking it to terminate using kill 12889 where 12889 is the parent's process ID. But, if the parent is stubborn and refuses to go quietly, we can force the issue by running

kill -9 12889

At that point, the parent process will be removed from the system, its children (including any zombies) are given to init and the zombies will be removed.
Link
 Leave a comment
  • Leave a comment
  •  
  • Next Entry
  • Add As Memory
  • Tell a Friend
  • Previous Entry