Reactor claims not be running although reactor.run() has been called
|Reported by:||htj||Owned by:|
The following code fails in current twisted trunk:
from twisted.internet import reactor, defer def main(): reactor.stop() return if __name__ == '__main__': reactor.callWhenRunning(main) reactor.run()
The output is:
Unhandled error in Deferred: Traceback (most recent call last): File "/home/htj/pack/python/twisted/internet/base.py", line 389, in _continueFiring callable(*args, **kwargs) File "ting.py", line 8, in main d.addBoth(lambda _ : reactor.stop()) File "/home/htj/pack/python/twisted/internet/defer.py", line 210, in addBoth callbackKeywords=kw, errbackKeywords=kw) File "/home/htj/pack/python/twisted/internet/defer.py", line 182, in addCallbacks self._runCallbacks() --- <exception caught here> --- File "/home/htj/pack/python/twisted/internet/defer.py", line 317, in _runCallbacks self.result = callback(self.result, *args, **kw) File "ting.py", line 4, in main reactor.stop() File "/home/htj/pack/python/twisted/internet/base.py", line 480, in stop raise RuntimeError, "can't stop reactor that isn't running" exceptions.RuntimeError: can't stop reactor that isn't running
This has worked well in previous versions if twisted. Am I doing anything wrong? If I start doing actual IO the above structure works well.
I've tracked down the change in behaviour to be in internet/base.py from changeset 20909: http://twistedmatrix.com/trac/changeset/20909
Although I do not really an idea of whats causing it.
I'm not quite sure how to have this as a trial test, it seems to be related to events during startup.
Change History (8)
comment:6 Changed 9 years ago by therve
- Milestone twisted-8.0 deleted
- Priority changed from high to normal