
From an old thread[1]:
On Sat, 2005-06-11 at 11:35 -0400, Jp Calderone wrote:
On Sat, 11 Jun 2005 11:08:12 -0400, Matt Feifarek <matt.feifarek@gmail.com> wrote:
On 6/10/05, Itamar Shtull-Trauring <itamar@itamarst.org> wrote:
Register the same SIGCHLD handler twisted does in the main thread, that should work (they need to be reentrancy-safe anyway so the fact it's called from a different thread is fine). Possibly a more general solution could be devised for this, anyone have suggestions?
Thanks.
So this behavior is by design? Again, it DID work before; for the last year or so, I've been using this code in production on a few servers.
Yep, and always has been. If it ever worked, it was by accident (I really don't see how it could have, though, so I can't begin to guess what might have changed to stop it).
Perhaps a note could be made in the docs that ProcessProtocol doesn't work in this case.
This will make it pretty hard to integrate into other worlds. I'm not sure that I can over-ride the signal handling in Webware and register handlers. Other bits of python libraries might be the same way.
I look forward to any "more general solution" that anyone can come up with!
Here's one:
def reapChildren(): from twisted.internet import reactor, task t = task.LoopingCall(reactor._handleSigchld, None, None) return t.start(5)
Of course, it uses a non-public method of reactor (but installSignalHandlers is a non-public argument to reactor.run(), so you're already treading on thin ice :)
I'm trying to diagnose an intermittent pausing problem on Win32, and t.i.process is unavailable on that platform, which reapChildren() relies on. Is there no need for this approach when launching the reactor with installSignalHandlers=0 on Windows? Steve [1]http://twistedmatrix.com/pipermail/twisted-python/2005-June/010692.html