LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 09:28 AM   #1
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

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

Rep: Reputation: 70
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 12:01 PM. Reason: clarify wait() behavior
 
Old 09-09-2007, 01: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: 30
Is there a quick way to find the parent?

Thanks,

Harlin
 
Old 09-09-2007, 02:15 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
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, 03: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: 30
Fair enough. Thanks for the help though.

Harlin
 
Old 09-09-2007, 04:06 PM   #6
b0uncer
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 12:23 PM. Reason: fixed an error..
 
Old 09-10-2007, 11: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, 12:06 PM   #8
Harlin
Member
 
Registered: Dec 2004
Location: Atlanta, GA U.S.
Distribution: I play with them all :-)
Posts: 316

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


Reply

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:13 AM
How to kill a defunct process guarriman Linux - Software 4 05-15-2009 12:09 PM
howto kill defunct processes mocean Suse/Novell 6 08-06-2007 12:20 AM
Unable to kill process rvsridhar Linux - General 5 03-13-2006 09:07 AM
Unable to Kill X flebber VectorLinux 2 07-24-2005 01:55 AM


All times are GMT -5. The time now is 03:17 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration