[Twisted-Python] Qtreactor problem on twisted 2.1
James Y Knight
foom at fuhm.net
Fri Dec 30 11:42:02 EST 2005
On Dec 30, 2005, at 10:26 AM, Umit Oztosun wrote:
> Our application uses twisted as the core network framework. It
> basically consists of a server and multiple clients. All communication
> is carried on a twisted.spread.pb channel. We have been using twisted
> 1.3 since the beginning, we decided to switch to twisted 2.1, the
> switch was easy but an interesting problem showed up.
> Our client is based on PyQt, so uses qtreactor. If something goes
> wrong on the server side, the error is transferred to the client
> (automagically, thanks to twisted & deferreds), and handled there
> (with an errback). We warn our users about the failure with a dialog.
> The interesting part is, with twisted 2.1, at the dialog's exec_loop()
> call, occasionally the connection between the server and client goes
> away with the following exception:
For some reason, the stack trace looks truncated, since it starts
with defer.py:addCallbacks. But my guess is that read is getting
called re-entrantly. By calling exec_loop within a callback, you're
causing the reactor to loop within another reactor loop, and the
reactor isn't designed to ensure it's safe to do that. Is it possible
to change the code to show a dialog box without running a sub-loop?
More information about the Twisted-Python