[issue14548] garbage collection just after multiprocessing's fork causes exceptions

sbt report at bugs.python.org
Thu Apr 12 01:07:36 CEST 2012

sbt <shibturn at gmail.com> added the comment:

> That's a problem indeed. Perhaps we need a global "fork lock" shared
> between subprocess and multiprocessing?

I did an atfork patch which included a (recursive) fork lock.  See


The patch included changes to multiprocessing and subprocess.  (Being able to acquire the lock when doing fd manipulation is quite useful.  For instance, the creation of Process.sentinel currently has a race which can mean than another process inherits the write end of the pipe.  That would cause Process.join() to wait till both processes terminate.)

Actually, for Finalizers I think it would be easier to just record and check the pid.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list