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

James Y Knight foom at fuhm.net
Sat Jun 11 11:40:11 EDT 2005

On Jun 11, 2005, at 11:08 AM, Matt Feifarek wrote:
> 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.
> Perhaps a note could be made in the docs that ProcessProtocol doesn't
> work in this case.

There is one. It logs "spawnProcess called, but the SIGCHLD handler  
is not installed. This probably means you have not yet called  
reactor.run, or called reactor.run(installSignalHandler=0). You will  
probably never see this process finish, and it may become a zombie  
process." However, your example doesn't have logging setup, so you  
don't see that message.

> 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!

If you cannot override the signal handling, do something like:

from twisted.internet import task
task.LoopingCall(process.reapAllProcesses).start(1.0, now=False)

That's less efficient but will work. I have a vague recollection that  
in old versions twisted used to do this by default but I might just  
be making that up.


More information about the Twisted-Python mailing list