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, jcea, lesha, neologix, nirai, pitrou, sbt, sdaoden, vinay.sajip, vstinner
Date 2012-05-23.02:00:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This is a reply to:

Charles-François raises two problems:

1) LinuxThreads have different PIDs per thread. He then points out that LinuxThreads have long been deprecated.

2) you cannot release locks on fork() because that might let the forked process access protected resources.

My replies:

(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.

(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.

All I meant is that we could introduce a special lock class "ForkClearedRLock" that self-releases on fork(). We could even use Charles-François's reinit magic for this.

Using ForkClearedRLock in "logging" would prevent deadlocks. The only potential harm that would come from this is that your logfile might get pretty ugly, i.e. the fork parent and child might be printing simultaneously, resulting in logs like:

Error: parentparentparError: childchildchildchildchild

It's not great, but it's definitely better than deadlocking.

I don't think logging can do anything more sensible across fork() anyway.

Did this explanation make more sense?
Date User Action Args
2012-05-23 02:00:56leshasetrecipients: + lesha, gregory.p.smith, vinay.sajip, jcea, pitrou, vstinner, nirai, bobbyi, neologix, Giovanni.Bajo, sdaoden, sbt, avian
2012-05-23 02:00:56leshasetmessageid: <>
2012-05-23 02:00:55leshalinkissue6721 messages
2012-05-23 02:00:54leshacreate