Killing a defunct process on UNIX system

gagneet picture gagneet · Dec 10, 2008 · Viewed 86.6k times · Source

I have a defunct process on my system:

abc      22093 19508  0 23:29 pts/4    00:00:00 grep ProcA
abc      31756     1  0 Dec08 ?        00:00:00 [ProcA_my_collect] <defunct>

How can I kill the above process, without a reboot of the machine? I have tried with

kill -9 31756
sudo kill -9 31756

Answer

Bill Karwin picture Bill Karwin · Dec 10, 2008

You have killed the process, but a dead process doesn't disappear from the process table until its parent process performs a task called "reaping" (essentially calling wait(3) for that process to read its exit status). Dead processes that haven't been reaped are called "zombie processes."

The parent process id you see for 31756 is process id 1, which always belongs to init. That process should reap its zombie processes periodically, but if it can't, they will remain zombies in the process table until you reboot.