Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2003 15:41:26 -0700
From:      Joshua Oreman <oremanj@webserver.get-linux.org>
To:        Chuck Swiger <cswiger@mac.com>
Cc:        questions@freebsd.org
Subject:   Re: Zombie Process
Message-ID:  <20030522224126.GB17789@webserver.get-linux.org>
In-Reply-To: <3ECCFDCF.4020103@mac.com>
References:  <4306.192.168.1.155.1053612014.squirrel@vipersystems.biz> <3ECCFDCF.4020103@mac.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

HTH,
-- Josh

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030522224126.GB17789>