Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Killing a defunct process on UNIX system [closed]

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 
like image 339
gagneet Avatar asked Dec 10 '08 16:12

gagneet


People also ask

Can we kill defunct process in Linux?

A zombie is already dead, so you cannot kill it. To clean up a zombie, it must be waited on by its parent, so killing the parent should work to eliminate the zombie. (After the parent dies, the zombie will be inherited by pid 1, which will wait on it and clear its entry in the process table.)

How do I kill a sleeping process in Linux?

Terminating a Process using kill Command You can use either the ps or pgrep command to locate the PID of the process. Also, you can terminate several processes at the same time by entering multiple PIDs on a single command line. Lets see an example of kill command. We would kill the process 'sleep 400' as shown below.


2 Answers

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.

like image 76
Bill Karwin Avatar answered Sep 23 '22 23:09

Bill Karwin


Did you check for a child process that may need to be killed first? Sometimes the jam up is down the line... Try ps -ef --forest

to see what may be below it (if anything) then kill that first, then the one you already know about

like image 24
curtisk Avatar answered Sep 26 '22 23:09

curtisk