twisted.python.threadpool instantiates Failures in a non-reactor thread

[email protected] Thu, 14 Jan 2010 19:54:37 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from exarkun <[email protected]>:

`ThreadPool._worker` is run in a thread other than the reactor thread.  If the function it runs raises an exception, it creates a `Failure` to send back to the main thread.

There's no guarantee that `Failure` is thread-safe.  And, as it turns out, when Failure debugging is enabled, the creation of `Failure` instances from multiple threads leads to multiple concurrent pdb sessions fighting over stdio.

`_worker` should just grab `sys.exc_info()` and pass that back to the reactor thread to be turned into a `Failure`.


----------
Type     : defect
Component: core
Keywords : 
Priority : normal
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4219