[plug] zombie GDM processes

James Devenish devenish at guild.uwa.edu.au
Fri Aug 15 19:53:43 WST 2003


Hi,

In message <3F3C7D4D.1060100 at postnewspapers.com.au>
on Fri, Aug 15, 2003 at 02:27:25PM +0800, Craig Ringer wrote:
> am responding via the archvies

I know the feeling :)

> > Zombie processes don't really exist (it's just that the parent process
> > hasn't received the appropriate signals to indicate that its child has
> > died) -- was the parent process okay (let's hope it wasn't `init`!).
> 
> Hmm... good to know. Perhaps the GDM parent process was hung/insane or 
> otherwise not working,

I would imagine that is the typical reason for zombie processes. I
suppose it depends on your operating system, but I thought that a zombie
process could arise from a situation like this:

 - parent spawns child and waits for child to die,
 - parent hangs,
 - child dies,
 - kernel waits for parent to "unhang" so that the parent
   can be told that the child died.

In this situation, the kernel is keeping the child's process table entry
occupied even though there is absolutely no process associated with it.
That is, the kernel does not want to re-use the child's process ID until
the parent has been informed that the processed has terminated. Thus a
"zombie process" is actually just a "dangling table entry", *not* a
process (that's why it can't be killed). It exists only so that
inter-process communication can be finalised. Thus, zombie process can
often exist on a given system, though they will exist so briefly that
you wouldn't notice (i.e. there will be a finite delay between when a
child dies and when the parent process is next scheduled to run).

For example:

 - start vim and tell it to :!cat > /tmp/zombie_test
 - on another terminal, run `top`
 - on another terminal (or via `top`, if that is convenient for you), do
   `pkill -STOP -n vim`.
 - run `lsof` and see that cat is using zombie_test
 - now do `pkill -n cat`.
 - you should have a zombie/defunct cat process and a stopped vim
   process (as reported by top or `ps`).
 - run `lsof` and see that there is no cat process and zombie_test is
   not open by any process.
 - then, run `pkill -CONT -n vim`.
 - the zombie should disappear and vim will be running normally, so quit
   vim and top (and remove /tmp/zombie_test :).

What I am trying to illustrate is that trying to kill cat will never
make an improvement (it doesn't exist, it's not using any files, and
it's not its fault that vim wasn't listening) -- you have to get vim
going or kill vim.




More information about the plug mailing list