[Twisted-Python] Change in reactor.stop() in Twisted 8.x
Hi, We have been using Twisted for a long time and are migrating to 8.0.1. We are finding that code that ran fine with 2.5.0 is giving problems with 8.0.1 and it appears to be related to what is happening in reactor.stop(). The code that is failing looks like this: ########## from twisted.internet import reactor d = doSomeThingThatReturnsADeferred() d.addCallback(handleOK) d.addCallback(lambda _: reactor.stop()) reactor.run() ########## The doSomeThingThatReturnsADeferred method is making XMLRPC calls underneath the hood. When we run this, it runs OK, but then blows up at the end with: Traceback (most recent call last): File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/defer.py", line 185, in addCallbacks self._runCallbacks() File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/defer.py", line 323, in _runCallbacks self.result = callback(self.result, *args, **kw) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/base.py", line 387, in _continueFiring callable(*args, **kwargs) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/base.py", line 524, in disconnectAll failure.Failure(main.CONNECTION_LOST)) --- <exception caught here> --- File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/python/log.py", line 51, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/python/log.py", line 36, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/python/context.py", line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/python/context.py", line 37, in callWithContext return func(*args,**kw) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/tcp.py", line 577, in connectionLost self.connector.connectionLost(reason) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/base.py", line 937, in connectionLost self.factory.clientConnectionLost(self, reason) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/web/xmlrpc.py", line 325, in clientConnectionLost self.deferred.errback(reason) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/defer.py", line 264, in errback self._startRunCallbacks(fail) File "/Library/Python/2.5/site-packages/Twisted-8.0.1-py2.5-macosx-10.5-i386.egg/twisted/internet/defer.py", line 293, in _startRunCallbacks raise AlreadyCalledError twisted.internet.defer.AlreadyCalledError: I have checked and there is no failure object in my callback chain - this is internal to Twisted. Has the logic in reactor.stop changed recently? Any ideas about what would be causing this? Thanks Brian
On Wed, May 7, 2008 at 2:41 PM, Brian Granger <ellisonbg.net@gmail.com> wrote:
Hi,
We have been using Twisted for a long time and are migrating to 8.0.1. We are finding that code that ran fine with 2.5.0 is giving problems with 8.0.1 and it appears to be related to what is happening in reactor.stop().
Please try the Twisted 8.1.0 prerelease available at http://twistedmatrix.com/users/radix/8.1.0pre2/ -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
Hi,
We have been using Twisted for a long time and are migrating to 8.0.1. We are finding that code that ran fine with 2.5.0 is giving problems with 8.0.1 and it appears to be related to what is happening in reactor.stop().
Please try the Twisted 8.1.0 prerelease available at
Using 8.1.0pre2 does solve this problem. I am curious, what changed in 8.0.1 (and was fixed in 8.1.0) that causes this? Also, will this fix be backported to 8.0.x or should we recommend that people, use Twisted >= 2.5.0 but not 8.0.1? Thanks! Brian
-- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Thu, 15 May 2008 21:20:05 -0600, Brian Granger <ellisonbg.net@gmail.com> wrote:
Hi,
We have been using Twisted for a long time and are migrating to 8.0.1. We are finding that code that ran fine with 2.5.0 is giving problems with 8.0.1 and it appears to be related to what is happening in reactor.stop().
Please try the Twisted 8.1.0 prerelease available at
Using 8.1.0pre2 does solve this problem. I am curious, what changed in 8.0.1 (and was fixed in 8.1.0) that causes this? Also, will this fix be backported to 8.0.x or should we recommend that people, use Twisted >= 2.5.0 but not 8.0.1?
It's not likely that there'll be another 8.0.x release. We considered doing one, but since 8.0.1 isn't packaged in any major distribution, there doesn't seem to be much point. Jean-Paul
On 2008.05.16 08:08:17 -0400, Jean-Paul Calderone wrote:
It's not likely that there'll be another 8.0.x release. We considered doing one, but since 8.0.1 isn't packaged in any major distribution, there doesn't seem to be much point.
It's in Gentoo. (Marked as unstable on x86, but not masked.) -- David Ripton dripton@ripton.net
participants (4)
-
Brian Granger
-
Christopher Armstrong
-
David Ripton
-
Jean-Paul Calderone