[Twisted-Python] Problem: spawnProcess() never ending when installSignalHandlers=False

Jp Calderone exarkun at divmod.com
Sat Jun 11 11:35:37 EDT 2005

On Sat, 11 Jun 2005 11:08:12 -0400, Matt Feifarek <matt.feifarek at gmail.com> wrote:
>On 6/10/05, Itamar Shtull-Trauring <itamar at 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?
>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 :)


More information about the Twisted-Python mailing list