Jun 22, 2009

Kill a zombie process

Well, yes, everybody knows that zombie processes can't be killed, as they're already dead. That's all very well documented and repeated so many times, and the solution to this would be to: "kill the parent process".


Since killing the parent process makes init the parent of the zombie process which can kill zombies, if the real parent can't.

My problem was - how to get the parent process? That's not written anywhere! Why not? Is it so hard?

After some research it turns out it isn't.

You can get the parent process id (PPID) with the -o parameter in 'ps' command:

# ps auxo ppid | grep Z

You know what 'grep Z' does, don't you? It prints only the processes in the Zombie state.

Well when you get the ppid, the solution to zombie killing or reaping is simple.

Just kill -9 the ppid.

I hope this article saves someone from the midnight frustration on why the machine just won't start any new processes, even if CPU load and memory usage are near zero.