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 lesha
Recipients Giovanni.Bajo, avian, bobbyi, gregory.p.smith, lesha, neologix, nirai, pitrou, sbt, sdaoden, vstinner
Date 2012-01-13.11:02:10
SpamBayes Score 1.52683e-10
Marked as misclassified No
Message-id <>
Just wanted to say that I spent something like 8 hours debugging a subprocess + threading + logging deadlock on a real production system. 

I suspected one of my locks at first, but I couldn't find any. The post-fork code was very simple, and I didn't suspect that logging would be subject to the same issue.

The good news that I see a very clean solution for fixing this.

We can't free all locks across fork -- that is unsafe and mad, because the child might end up corrupting some shared (network) resource, for example/

However, extending RLock to provide ForkClearedRLock (this would be used by logging, i.e.) is quite straighforward.

The extended class would simply need to record the process ID, in which the lock was created, and the process ID, which is trying to acquire it.  Done!
Date User Action Args
2012-01-13 11:02:11leshasetrecipients: + lesha, gregory.p.smith, pitrou, vstinner, nirai, bobbyi, neologix, Giovanni.Bajo, sdaoden, sbt, avian
2012-01-13 11:02:11leshasetmessageid: <>
2012-01-13 11:02:10leshalinkissue6721 messages
2012-01-13 11:02:10leshacreate