[Twisted-Python] potential bug in the reactor's handling events loop

Jp Calderone exarkun at divmod.com
Fri Mar 4 11:29:20 EST 2005

On Wed, 02 Mar 2005 19:39:00 -0600, Andrzej Leszczynski <leszczynscy at yahoo.com> wrote:
>Python 2.3, one of the latest Twisted version:
> I noted that under Linux there is not way to Control-C the reactor loop. 
> After digging a little I found that following change helps:
> [root at d1501-0a10109c internet]# diff base.py{,.ori}
>  >
> 302d301
> <       print "1",sysEvtTriggers
> 305d303
> <       print "2",`self._eventTriggers`
> 307,308c305
> <         for callable, args, kw in sysEvtTriggers[1]:
> <           print "3"
> ---
>  >
>  >         for callable, args, kw in sysEvtTriggers[0]:
> 317d313
> <           print "4"
> 320d315
> <           print "5",`eventType`
> Of course it is quick work around, not a permanent fix, but it really helps.

  The change is completely broken, unfortunately :)  It executes the "during" triggers in the "before" phase, and entirely skips the "before" triggers.

  I'll hazard a guess that you're trying to run and stop the reactor twice, and that it only fails on the second attempt.  This behavior isn't supported (reactor.run() can only be called once in a process's lifetime).  

  If this isn't the case, could you include a minimal (but complete and self-contained) example which reproduces the undesirable behavior?


More information about the Twisted-Python mailing list