[Twisted-Python] when will failure.Failure() be a problem?

Itamar Turner-Trauring itamar at itamarst.org
Fri Mar 23 08:28:11 EDT 2012


On 03/23/2012 01:48 AM, gelin yan wrote:
> Hi All
>
>  As regards issues like #5567 & #4219, Failure object creation is not 
> thread safe. I use deferToThread daily due to many blocking apis still 
> have to be used in my system. I looked into the code and noticed there 
> is a global count used in Failure.__init__. An increment will be made 
> for every __init__ invoke. I consider it is one part can be treated as 
> thread unsafe.

It's not thread-safe... but the count is only used to display messages 
in certain particular cases, and all it means is that the count may be 
slightly off, or two Failure might have same count. It will not corrupt 
anything, or causes exceptions or crashes of any sort - it's a *very* 
minor bug.



More information about the Twisted-Python mailing list