Operating System - HP-UX
1821587 Members
3558 Online
109633 Solutions
New Discussion юеВ

Re: Killing Zombie process

 
Amit Manna_6
Regular Advisor

Killing Zombie process

Hi,

Can anybody tell me how to kill Zombie process??

Thanks and Regards,

Amit Manna
11 REPLIES 11
T G Manikandan
Honored Contributor

Re: Killing Zombie process

Zombie processes are created when it terminates without waiting for its child to terminate.

To my knowledge there is no way to kill a zombie process.

They can be cleaned up only on the next reboot.

check the white paper at /usr/share/doc/proc_mgt.txt
Robert-Jan Goossens
Honored Contributor

Re: Killing Zombie process

Hi Amit,

Check this doc for more info.

http://www4.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000063236571

Document description: Sys Adm: killing zombie/defunct processes
Document id: S1100000464

Regards,
Robert-Jan
Michael Tully
Honored Contributor

Re: Killing Zombie process

Most of the time you can't, as they are already dead. A zombie is generally created when a process has detached from it's parent. If they cannot be killed with -9 the only way these can be removed is by rebooting the system.
Anyone for a Mutiny ?
Klaas D. Eenkhoorn
Regular Advisor

Re: Killing Zombie process

Sometimes you can be lucky to kill a zombie process if you find the parent process and remove it with the kill -TERM option.

Due to bugs in a program somtimes the parent does'nt care any more for it's child processes and does not accept input from them any more so the child becomes a zombie and keeps waiting for that moment of attention.

When you remove the parent process with the kill -TERM option , not -9 this makes it abandon everything, or stop the main application, sometimes the program starts interacting with it's childs again because it wants to remove them.
And there you are, the zombie get's its attention and it stops.

But most of the time the only thing is rebooting the system because the parent process is long gone.

Kl@@s
Mark Grant
Honored Contributor

Re: Killing Zombie process

Your best bet is to ignore them unless you have hundreds of them.

A zombie takes up one entry in a process table. That's it, it does not take up any other system resources. Ok, if you have hundreds of them then that might become a problem but then you need to look at the application creating them.

As mentioned above, a zombie is a process that has finished but it's parent has not done a "wait()" on it.
Never preceed any demonstration with anything more predictive than "watch this"
Dietmar Konermann
Honored Contributor

Re: Killing Zombie process

As the others stated, zombies cannot be killed since they are already dead. However, they disappear when the parent wait()'s for them. If you kill the parent then init inherits and reaps it calling wait().

So, in general there's no need to reboot. The parent needs to call wait().

If the parent hangs, then you could be able to get rid of the zombie e.g. by killing it. If the parent cannot be killed, then this is another problem. If init (PID 1) is already the parent of the zumbie, then I personally would consider this as a bug (unless there are hw problems or similar).

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Nicolas Dumeige
Esteemed Contributor

Re: Killing Zombie process

FYI

With Solaris 9, "preap [-F] pid" : force a defunct process to be reaped by its parent.

Cheers

Nicolas

All different, all Unix
Richard Pereira_1
Regular Advisor

Re: Killing Zombie process

Basicly, if your zombie has a new parent ID, and if you can take that down, try killing the child then parent, if your process has been adopted by init (1 or 0), your stuck having to reboot since you cant kill init.

Good luck
Richard.
Geoff Wild
Honored Contributor

Re: Killing Zombie process

This sometimes works for me:

for i in `ps -el|grep -v SZ|grep Z|awk '{print $5}'`
do
ps -ef|grep -v grep|grep ${i} >>$logfile 2>&1

kill -18 ${i}
done

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Chris Watson
Super Advisor

Re: Killing Zombie process

I find that a chainsaw usually does the trick!
Moving along nicely
SAHA
Honored Contributor

Re: Killing Zombie process

when a child process dies, its memory is returned to the OS, but its entry in the process table isn't freed. This lets the parent check the exit status of its child processes. Processes that have died but haven't been removed from the process table are zombies. So, yes, try and can get the code sorted that is causing this.

Reboot is probably one of the sure way to get rid of these.

thanks,
You must PASS failure on way to success !!!