If you're using sig(CHLD => $event) to catch SIGCHLD, you should totally be 
using sig_child(PID => $event) instead.  sig(CHLD => $event) has problems that 
are going to be exacerbated by the next POE release.

Currently POE::Kernel->run() won't return until all child processes have 
exited.  I added that after a developer reported their production machines were 
crashing "because of POE".  It turned out they had a slow process leak that 
didn't cause problems in testing but would kill machines after long production 
runs.

Ideally the warning aims developers' guns away from their feet, but in practice 
there are more people gunning for developers' feet than just themselves.

I discovered this when Log::Log4perl::Appender::File shot me in the foot 
recently.  Or maybe I shot my own foot through a level of indirection.  I'm 
using its pipe mode to send logs through Apache's rotatelogs(8) utility.  The 
rotatelogs subprocess was deadlocking POE at exit.

This is POE's fault for being too cautious.  I've modified 
POE::Resource::Signals' finalization code to warn about running processes but 
not wait forever for them.

This broke a few tests that relied on POE::Kernel reaping processes for them.  
I'm pretty sure other people will run into this new warning when they upgrade.

$kernel->sig(CHLD => $event) is a big part of the problem.  It can't tell the 
difference between processes you want to reap, and ones encapsulated by a 
library that may never shut them down.

Which is why I added sig_child() five years ago.

commit e8a11d981f111afe92e56d6ade8ba08a3d5a077b
Author: Rocco Caputo <rcap...@cpan.org>
Date:   Sat Sep 16 05:33:53 2006 -0400

    Added sig_chlid(), test case, and documentation.  Resolves rt.cpan.org
    18392.  Collateral damage: POE::Loop::Event's signal handler callbacks
    have been replaced by POE::Loop::PerlSignals.

sig_child() can tell the difference.  It can keep a program running until all 
"interesting" processes are reaped, and it can release the program when they're 
all done.  You should totally be using that already.  If you aren't, consider 
this your warning to begin.

-- 
Rocco Caputo <ro...@plixer.com>

-- 
Rocco Caputo <rcap...@pobox.com>

Reply via email to