[Twisted-Python] connectionLost never reached after calling loseConnection: stuck in CLOSE_WAIT forever

Stefano Debenedetti ste at demaledetti.net
Mon Nov 1 08:34:13 MDT 2010


Il 31/10/2010 18:36, Stefano Debenedetti ha scritto:
> Il 30/10/2010 18:48, Stefano Debenedetti ha scritto:
>> http://twistedmatrix.com/trac/ticket/4719
> 
> I have attached a 2 lines patch that seems to fix the issue.

err, it seems to fix that issue but it introduces another issue:

  File "my/code.py", line 759, in loseConnection
    proto.transport.unregisterProducer()
  File "/home/lala/lib/python/twisted/internet/abstract.py", line
330, in unregisterProducer
    self.startWriting()
  File "/home/lala/lib/python/twisted/internet/abstract.py", line
290, in startWriting
    self.reactor.addWriter(self)
  File "/home/lala/lib/python/twisted/internet/epollreactor.py",
line 107, in addWriter
    self._add(writer, self._writes, self._reads, self._selectables,
_epoll.OUT, _epoll.IN)
  File "/home/lala/lib/python/twisted/internet/epollreactor.py",
line 88, in _add
    self._poller._control(cmd, fd, flags)
  File "_epoll.pyx", line 125, in _epoll.epoll._control

I just saw this appearing once in the logs of my app after I applied
the patch I suggested:

http://twistedmatrix.com/trac/attachment/ticket/4719/avoid_hang_in_CLOSE_WAIT.patch

I'll try to replicate and to figure out what does
FileDescriptor.unregisterProducer need to do instead of the probably
too dumb lines I added there:

if self.disconnecting:
    self.startWriting()

ciao
ste





More information about the Twisted-Python mailing list