[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kill: cannot kill some processes



On Thu, Feb 22, 2001 at 09:59:47PM -0800, Nate Amsden wrote:
> Brian Stults wrote:
> > 
> > As the subject indicates, there are some processes that hang and cannot
> > be killed.  Specifically, occasionally dselect will hang while trying to
> > install a package.  After waiting for a long time, I try both Ctrl-c and
> > Ctrl-z and neither will work.  Then I try to kill the process from
> > another xterm.  It looks as if the kill worked, but when I do a ps, the
> > job is still there.  It also just happened with df.  I use this to kill:
> > 
> > kill -9 [pid]
> > 
> > Any suggestions?
> 
> does the process list "Z" under STAT ? if it is the process has gone
> zombied and i don't think there is much you can do. sometimes zombie'd
> processes die on their own eventually many times they will not die until
> you reboot ..

Not quite true... zombies don't ever die: they're already dead.

So what are they doing there?

Simple: every process returns some stuff to it's parent: time used, and
a bunch of other stuff, most importantly the value 'exit()' returns.

A zombie is a process which has died, but its parent has not collected
that information.  It has to be held until the parent collects it.  With
a proper parent process, it will notice the child died and call wait()
and collect the return code and anything else it needs.

If the parent dies without collecting the return status, the zombie is
inherited by init.  init is smart enough to collect the status and let
the zombie go to the grave.

So the bug in a 'zombie' is in the process that spawned it.  Kill it,
and the zombie children will go away.  Most importantly, though, it is a
bug and should be fixed.  It's not difficult to write code that
correctly reaps dead children.

-- 
CueCat decoder .signature by Larry Wall:
#!/usr/bin/perl -n
printf "Serial: %s Type: %s Code: %s\n", map { tr/a-zA-Z0-9+-/ -_/; $_ = unpack
'u', chr(32 + length()*3/4) . $_; s/\0+$//; $_ ^= "C" x length; } /\.([^.]+)/g; 



Reply to: