[Python-Dev] Backport threading.py fix to 2.5.2?

Thomas Wouters twouters at google.com
Fri Jan 4 13:49:36 CET 2008


On Jan 4, 2008 2:46 AM, Guido van Rossum <guido at python.org> wrote:

> See http://bugs.python.org/issue1731. Should we consider it safe to
> backport r57216 to 2.5.2? This is Thomas Wouters's code to disable
> spurious tracebacks when daemon threads die. We're running some 2.4
> apps with (a variant of) this at Google that get many 1000s of
> invocations a day, so I'm pretty confident that it works.
>

I'm also pretty confident it works, although it isn't really guaranteed to
catch *all* such situations. No reason not to backport it, just a remark
about how it checks to see if Python is shutting down. It is, however,
incredibly unlikely '_sys' won't be gone when we check for it if the
exception is indeed a spurious one. What could happen is that a legitimate
exception happens right before interpreter shutdown, then a thread switch
occurs before Python tries to report the exception, the interpreter exits,
and then the daemonic thread starts to report its exception. The only way to
catch that is to do the 'are we exiting' check in the C code that does the
actual thread-exception reporting. I'm not sure if it's worth it, as the
timing has to be pretty exact for that to happen, and you wouldn't want to
introduce a bug there; could be years before someone figures it out :P

-- 
Thomas Wouters <twouters at google.com>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20080104/caed8baa/attachment-0001.htm 


More information about the Python-Dev mailing list