LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Reaping a zombie process (https://www.linuxquestions.org/questions/linux-software-2/reaping-a-zombie-process-877116/)

dazdaz 04-26-2011 04:04 AM

Reaping a zombie process
 
How can I reap a zombie process on Linux.

On Solaris I use the preap command but I can't find an equivalent command on Linux.

I can't kill the process because it's already dead and by it's nature the parent process is dead, so I can't kill that.
Assume that kill -1, -9 don't work.

I've searched the forums but have yet to find a method of removing it from the process table without compiling any C.

Is there a Linux command or something I set in /proc/<pid> to remove the process.

acid_kewpie 04-26-2011 05:18 AM

well by its nature the parent process is not necessarily dead at all, what is its parent? If it's gone then it would be re-parented up as far as the init process.

wpeckham 04-26-2011 10:49 AM

Zombie process
 
I never mess with the zombies.

As long as you leave them alone they hurt nothing, and the tables are fully cleaned by your next restart.

dazdaz 04-26-2011 12:34 PM

If the parent process was alive then I would send a SIGCHILD to the parent which would reap it's children however this is not an option in my case because the ppid is 1.

Although there is little impact, an extra process slot is used up, I still want to remove the zombie process.

Is it technically possible to do that under those circumstances without rebooting on Linux ?

dazdaz 05-01-2011 03:49 PM

Is it possible to attach kdb to init and send a waitpid() function. Would this free up the process slot ? A zombie may not hurt the system but I am curious to find a workable method.

Remember that init is now the ppid.

Where 23300 is the zombie pid slot. I use this as an example, however I have no practical experience with kgdb so the commands won't work.

I am not even sure if you can run kdb and activating it witin the kernel without stopping kernel execution from the same host.

# kgdb -p 1
(gdb) call waitpid(23300, 0, 0)
(gdb) quit


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