Re: zombies - half solved

2008-03-12 Thread Lars Noodén
 How are zombies best dealt with, correctively?

Sorry to answer my own question.  The solution was to find the parent
process and kill it.

But the second question still stands, is there a generic way to prevent
the formation of zombies?  The cause in this specific case is a
perl-based CGI script called by apache2.

Regards,
-Lars



Re: zombies - half solved

2008-03-12 Thread Stephen Takacs
Lars wrote:
 But the second question still stands, is there a generic way to prevent
 the formation of zombies?  The cause in this specific case is a
 perl-based CGI script called by apache2.

The easiest way might be to let perl auto-reap the children for you.
It's as simple as prepending this line within the block that spawns the
child processes:

local $SIG{CHLD} = 'IGNORE';  # straight outa perlipc(1)

One thing to watch out for though is that you may get weird side effects
if you set this and then use system() in the same scope.  If so, just
use wait/waitpid instead (it's only a few more lines of code).


-- 
Stephen Takacs   [EMAIL PROTECTED]   http://perlguru.net/
4149 FD56 D078 C988 9027  1EB4 04CC F80F 72CB 09DA