[issue6721] Locks in python standard library should be sanitized on fork

Richard Oudkerk report at bugs.python.org
Wed May 23 14:49:08 CEST 2012


Richard Oudkerk <shibturn at gmail.com> added the comment:

> (1) Good catch. I suspect that this could be mitigated even if we cared 
> about LinuxThreads. I haven't looked, but there's got to be a way to 
> determine if we are a thread or a fork child.

Using a generation count would probably work just as well as the PID: main 
process has generation 0, children have generation 1, grandchildren have 
generation 2, ...

> (2) I think I didn't explain my idea very well. I don't mean that we 
> should release *all* locks on fork. That will end in disaster, as 
> Charles-François amply explained.

So what are you suggesting?  That a lock of the default type should raise
an error if you try to acquire it when it has been acquired in a previous
process?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6721>
_______________________________________


More information about the Python-bugs-list mailing list