Ticket #3168 regression closed fixed
ClientFactory.clientConnectionFailed re-entrancy problem
| Reported by: | exarkun | Owned by: | |
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | Branch: | ||
| Author: | Launchpad Bug: |
Description
Consider:
from twisted.internet import protocol, reactor class Stopper(protocol.ClientFactory): def clientConnectionFailed(self, connector, reason): print 'here' reactor.stop() def main(): reactor.connectTCP("localhost", 12345, Stopper()) reactor.run() if __name__ == '__main__': 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:
here
here
Traceback (most recent call last):
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/defer.py", line 186, in addCallbacks
self._runCallbacks()
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/defer.py", line 328, in _runCallbacks
self.result = callback(self.result, *args, **kw)
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/base.py", line 387, in _continueFiring
callable(*args, **kwargs)
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/base.py", line 524, in disconnectAll
failure.Failure(main.CONNECTION_LOST))
--- <exception caught here> ---
File "/home/exarkun/Projects/Twisted/trunk/twisted/python/log.py", line 51, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/exarkun/Projects/Twisted/trunk/twisted/python/log.py", line 36, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/exarkun/Projects/Twisted/trunk/twisted/python/context.py", line 59, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/exarkun/Projects/Twisted/trunk/twisted/python/context.py", line 37, in callWithContext
return func(*args,**kw)
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/tcp.py", line 574, in connectionLost
self.failIfNotConnected(error.ConnectError(string=reason))
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/tcp.py", line 479, in failIfNotConnected
self.connector.connectionFailed(failure.Failure(err))
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/base.py", line 929, in connectionFailed
self.factory.clientConnectionFailed(self, reason)
File "foo.py", line 6, in clientConnectionFailed
reactor.stop()
File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/base.py", 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
Note: See
TracTickets for help on using
tickets.
