This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Devin Jeanpierre
Recipients Devin Jeanpierre, gregory.p.smith
Date 2014-04-03.20:20:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396556457.93.0.286132850658.issue21149@psf.upfronthosting.co.za>
In-reply-to
Content
If another thread is active during interpreter shutdown, it can hold the last reference to a handler; when it drops that reference, the weakref callback -- _removeHandlerRef -- will be executed in this other thread. So while this callback is running, the main thread is replacing module globals with None. This creates a data race for the globals in logging -- for example, _releaseLock can be replaced with None after the "_releaseLock is not None" check, but before it is used.

In principle I suspect this could cause a deadlock, in practice all I've seen are exception messages mentioning how None is not callable.

I have attached a patch that I think resolves this issue. The patch is written against 2.7, although I expect this issue affects all versions of Python prior to 3.4

BTW, the copyright for this patch belongs to my employer, Google; please let me know if there are any contributor agreements or such that my employer needs to look at.
History
Date User Action Args
2014-04-03 20:20:57Devin Jeanpierresetrecipients: + Devin Jeanpierre, gregory.p.smith
2014-04-03 20:20:57Devin Jeanpierresetmessageid: <1396556457.93.0.286132850658.issue21149@psf.upfronthosting.co.za>
2014-04-03 20:20:57Devin Jeanpierrelinkissue21149 messages
2014-04-03 20:20:57Devin Jeanpierrecreate