LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-09-2007, 08:28 AM   #1
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Rep: Reputation: 38
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
 
Old 09-09-2007, 12:20 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
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.

Last edited by osor; 09-10-2007 at 11:01 AM. Reason: clarify wait() behavior
 
Old 09-09-2007, 12:55 PM   #3
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Original Poster
Rep: Reputation: 38
Is there a quick way to find the parent?

Thanks,

Harlin
 
Old 09-09-2007, 01:15 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 09-09-2007, 02:58 PM   #5
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Original Poster
Rep: Reputation: 38
Fair enough. Thanks for the help though.

Harlin
 
Old 09-09-2007, 03:06 PM   #6
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
*DON'T* kill process #1 in an attempt to get rid of them ;}
I think it shouldn't even be possible. There's no sane reason to kill init (any such reason leads to resetting or running shutdown anyway)..

pstree is also a handy tool, try it out - shows processes in a treeview.

Last edited by b0uncer; 09-10-2007 at 11:23 AM. Reason: fixed an error..
 
Old 09-10-2007, 10:19 AM   #7
cconstantine
Member
 
Registered: Dec 2005
Distribution: RedHat, Ubuntu
Posts: 101

Rep: Reputation: 15
tiny clarificationn on "wait()" behaviour...

Quote:
Originally Posted by osor View Post
The only reason they are still in the process table is that the parent is wait()ing for it.
I'm not knitpicking; just want to make sure the original poster has it clear...

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
 
Old 09-10-2007, 11:06 AM   #8
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

Original Poster
Rep: Reputation: 38
No worries... I don't plan on doing an init kill anytime soon. ;-)
 
  


Reply

Tags
defunct, init, kill, pid, process, ps, zombie



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to kill <defunct> sibtay Linux - Newbie 9 11-22-2010 03:13 AM
How to kill a defunct process guarriman Linux - Software 4 05-15-2009 11:09 AM
howto kill defunct processes mocean SUSE / openSUSE 6 08-05-2007 11:20 PM
Unable to kill process rvsridhar Linux - General 5 03-13-2006 08:07 AM
Unable to Kill X flebber VectorLinux 2 07-24-2005 12:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration