Zombie Process

Joshua Oreman oremanj at webserver.get-linux.org
Thu May 22 15:40:21 PDT 2003

On Thu, May 22, 2003 at 12:41:51PM -0400 or thereabouts, Chuck Swiger seemed to write:
> Jason Lieurance wrote:
> [ ... ]
> Zombie processes are mostly harmless: they are a process which has 
> finished and is sticking around because their parent hasn't reaped their 
> exit status.  Have the parent process do a wait()...

NOTE: This email is intended for if you really, truly, want to get rid
      of those zombies. These procedures are untested, but they should
      work :-)

Do `ps ax` and find the PID of the child. Then this:
$ ps axo ppid -p <the-pid-of-the-child> | grep -v PPID | sed 's/ //g'

It will show the PID of the parent. From now on, this will be referred
to as the-ppid. Now:
$ which `ps axo command -p <the-ppid> | grep -v COMMAND | cut -d' ' -f1`

It will give you the program - if not, try and find it yourself. This
will be called /path/to/the/program. The PID of the child will be called
the-pid. Now `debug' the parent program and call wait():

$ gdb /path/to/the/program the-ppid
(gdb) call wait(the-pid)

If it takes very long here, hit ^C.

(gdb) quit
The program is running. Quit anyway (and detach it)? yes
$ kill -CONT the-ppid

The zombie should've disappeared if you didn't have to press ^C; if you
did, just don't worry about it.

-- Josh

> -Chuck
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"

More information about the freebsd-questions mailing list