[Twisted-Python] buildProtocol never called

travis+ml-twisted at subspacefield.org travis+ml-twisted at subspacefield.org
Sat Jul 4 18:08:42 MDT 2009


On Sat, May 30, 2009 at 06:17:54PM -0500, travis+ml-twisted at subspacefield.org wrote:
> The problem I'm having is this; I upgraded my firewall from OpenBSD
> 4.2 or so to OpenBSD 4.5, and now I'm working with newer versions of
> all the software including Twisted.
> 
> 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).

I ran ktrace/kdump against the binary and it appears that python likes to
open file handles to the script and certain modules for file descriptors
5-7 or so (depending on how much you import), and if you close those file
descriptors, unusual things happen when python tries to access them.

In the end I decided it was not important enough to close all the parent's
file descriptors, and it runs fine as a deamon leaving them open.
-- 
Obama Nation | My emails do not have attachments; it's a digital signature
that your mail program doesn't understand. | http://www.subspacefield.org/~travis/ 
If you are a spammer, please email john at subspacefield.org to get blacklisted.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20090704/6193fcb4/attachment.sig>


More information about the Twisted-Python mailing list