Unable to kill <defunct>
Hi All,
When I run 'ps -e | grep defunct' I get this: [root@stk-srv01 scripts]# ps -e | grep defunct 1659 ? 00:00:00 sh <defunct> 14071 ? 00:00:00 sh <defunct> 28954 ? 00:00:00 sh <defunct> I tried to run 'kill -9 [pid#]' and they dont go away. Is there any way to get rid of these processes? Thanks, Harlin |
These zombie processes are for most intents and purposes “finished” execution. The only reason one may still be in the process table is that the parent has not yet wait()ed for it. This usually means the parent has a bug or is in an exceptional state. The only way to kill the zombie process is to kill its parent.
|
Is there a quick way to find the parent?
Thanks, Harlin |
ps -ef
gives the parent (PPID). But you'll find that those things are often orphaned as well, and hence owned by init ... *DON'T* kill process #1 in an attempt to get rid of them ;} Cheers, Tink |
Fair enough. Thanks for the help though.
Harlin |
Quote:
pstree is also a handy tool, try it out - shows processes in a treeview. |
tiny clarificationn on "wait()" behaviour...
Quote:
the zombie proc is laying around because the parent has NOT yet called the wait() system call to syncronize it's execution with the child. When the parent calls wait(), the child process -- really, one of it's children if it has more than one zombie -- will be cleaned up. Of course, if the parent is buggy, or poorly written, it'll never actually call wait() and you have zombies until you kill the parent (as someone else already pointed out.) -c |
No worries... I don't plan on doing an init kill anytime soon. ;-)
|
All times are GMT -5. The time now is 04:19 PM. |