Opened 10 years ago

Closed 10 years ago

#3168 release blocker: regression closed fixed (fixed)

ClientFactory.clientConnectionFailed re-entrancy problem

Reported by: Jean-Paul Calderone Owned by:
Priority: highest Milestone:
Component: core Keywords:
Cc: Branch:



from twisted.internet import protocol, reactor

class Stopper(protocol.ClientFactory):
    def clientConnectionFailed(self, connector, reason):
        print 'here'

def main():
    reactor.connectTCP("localhost", 12345, Stopper())

if __name__ == '__main__':

With Twisted 2.5.0, this results in here being printed once and the process exiting. With Twisted 8.0.1, this is the result:

Traceback (most recent call last):
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 186, in addCallbacks
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 328, in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 387, in _continueFiring
    callable(*args, **kwargs)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 524, in disconnectAll
--- <exception caught here> ---
  File "/home/exarkun/Projects/Twisted/trunk/twisted/python/", line 51, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/python/", line 36, in callWithContext
    return{ILogContext: newCtx}, func, *args, **kw)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/python/", line 59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/python/", line 37, in callWithContext
    return func(*args,**kw)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 574, in connectionLost
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 479, in failIfNotConnected
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 929, in connectionFailed
    self.factory.clientConnectionFailed(self, reason)
  File "", line 6, in clientConnectionFailed
  File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/", line 490, in stop
    "Can't stop reactor that isn't running.")
twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.

Change History (6)

comment:1 Changed 10 years ago by Jean-Paul Calderone

This seems to have roughly the same origin as #3146

comment:2 Changed 10 years ago by Jean-Paul Calderone

(In [23273]) Perhaps a test for #3168

refs #3168

comment:3 Changed 10 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Glyph deleted
Priority: highhighest

See #3146.

comment:4 Changed 10 years ago by Jean-Paul Calderone

(In [23342]) Refer to another ticket

refs #3168 refs #3146 refs #3198

comment:5 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed
Resolution: fixed
Status: newclosed

This was resolved r23345

comment:6 Changed 7 years ago by <automation>

Note: See TracTickets for help on using tickets.