[Twisted-Python] buildProtocol never called

Jean-Paul Calderone exarkun at divmod.com
Sat May 30 20:26:40 EDT 2009

On Sat, 30 May 2009 18:36:16 -0500, travis+ml-twisted at subspacefield.org wrote:
>On Sat, May 30, 2009 at 06:17:54PM -0500, travis+ml-twisted at subspacefield.org wrote:
>> The program works fine normally, and can run in the background, but if I
>> invoke a daemonize() routine that turns it into a network daemon, it
>> refuses to serve incoming TCP connections.  Actually the TCP connection
>> is made, but the software never responds to it.
>> Specifically, my twisted.internet.protocol.Factory instance is created,
>> but buildProtocol is never called.
>> Before I dive deeply into debugging the software, I thought I'd ask if
>> anyone knew off the top of their head any reason why Twisted might not
>> act the same if it was daemonized (no controlling terminal, no
>> stdin/out/err, forked as a background process).
>Here's some behavior I've gathered through debugging.  Note that all of
>the daemonization occurs before starting the reactor.

Creating the reactor at all may create a file descriptor which is necessary
for its operation.  Closing these will very likely cause problems.

Also, Twisted has daemonization features already which are known to work
well. ;)  Why aren't you using these?


More information about the Twisted-Python mailing list