[Twisted-Python] Sporadic GeneratorExit when using deferredGenerator

I receive a GeneratorExit occasionally when using Twisted. Has anyone noticed this problem? t I am on python 2.5 - as I understand it, GeneratorExit derives from StandardError in 2.5, and BaseException in 2.6. The real problem in my code appears to be that the reference to my generator itself is being dropped, causing it to become invalidated. Additionally, the errback/callback chain is not propagating the error correctly. Has anyone experienced similar problems?

On May 10, 2010, at 8:04 PM, CARSON DEAN FENIMORE wrote:
I receive a GeneratorExit occasionally when using Twisted. Has anyone noticed this problem? t I am on python 2.5 - as I understand it, GeneratorExit derives from StandardError in 2.5, and BaseException in 2.6. The real problem in my code appears to be that the reference to my generator itself is being dropped, causing it to become invalidated. Additionally, the errback/callback chain is not propagating the error correctly.
Has anyone experienced similar problems?
I don't know. Do you have a traceback? Where do you receive GeneratorExit?

Just FYI: The problem appears to have gone away with some minor changes. We have twisted in use in a large application, which consists of many threads. These threads were invoking some twisted-related methods; for example, calling addCallback on a Deferred instance from one thread, while running a deferredGenerator in twisted -- this, of course, is not thread safe! Except for a handful of such cases, we were using twisted correctly - adding callbacks on the main thread solved the issue at hand. On Mon, May 10, 2010 at 6:35 PM, Glyph Lefkowitz <glyph@twistedmatrix.com> wrote:
On May 10, 2010, at 8:04 PM, CARSON DEAN FENIMORE wrote:
I receive a GeneratorExit occasionally when using Twisted. Has anyone noticed this problem? t I am on python 2.5 - as I understand it, GeneratorExit derives from StandardError in 2.5, and BaseException in 2.6. The real problem in my code appears to be that the reference to my generator itself is being dropped, causing it to become invalidated. Additionally, the errback/callback chain is not propagating the error correctly.
Has anyone experienced similar problems?
I don't know. Do you have a traceback? Where do you receive GeneratorExit?
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

On May 11, 2010, at 8:28 PM, CARSON DEAN FENIMORE wrote:
Just FYI: The problem appears to have gone away with some minor changes. We have twisted in use in a large application, which consists of many threads. These threads were invoking some twisted-related methods; for example, calling addCallback on a Deferred instance from one thread, while running a deferredGenerator in twisted -- this, of course, is not thread safe! Except for a handful of such cases, we were using twisted correctly - adding callbacks on the main thread solved the issue at hand.
Glad you solved your problem, and thanks for reporting your conclusions here so future readers don't have to wonder what the heck was going on! :)
participants (2)
-
CARSON DEAN FENIMORE
-
Glyph Lefkowitz