[Twisted-Python] neverending connection

grolgh grolgh at online.no
Thu May 10 15:02:37 EDT 2001


Hello twisted.minions :)

This is my first mail on tp-ml; hello! I'm currently working on twisted.ftp 
and it's about 30% into acceptable working state. To hack it you need to press 
enter twice :) But I've run into a known problem.

I just noticed that TCPServer.loseConnection never trigs 
TCPServer.connectionLost. I think this is the famous 
never-ending-connection-bug, and I think the bug has its origin in 
selectable.doWrite.

I'll here present my current findings with it. Note that doSelect will run its 
selectable.connectionLost() if selectable's doRead or doWrite returns anything 
non-zero.
 
I'll take it step by step.
A call to loseConnection, will set __reap
Afterwards, __reap appears in doWrite which will write out its buffer and 
return CONNECTION_DONE
doSelect terminates the connection

Well, if we take a closer look at doWrite we find that it has several layers 
of if's before a CONNECTION_DONE is returned. Especially "if not self.unsent"! 
:/

Well, hope anyone finds this useful; and squash that horrible thing out. :)






More information about the Twisted-Python mailing list