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 gregory.p.smith
Recipients gregory.p.smith, yilei
Date 2022-01-21.23:59:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642809593.03.0.696330770978.issue46464@roundup.psfhosted.org>
In-reply-to
Content
For context, the fundamental problem is that os.fork() is unsafe to use in any process with threads.  concurrent/futures/process.py violates this.  So long as its design involves a thread, it can never be guaranteed not to deadlock.

POSIX forbids execution of most code after fork() has been called.  Returning to the CPython interpreter after os.fork() in the child process is never safe unless the parent process had no threads at fork time.

The change that triggered the issue moved from doing all of the os.fork() calls for the workers up front *before the thread was spawned* to doing them on demand after the thread was running.

The bugfix for this is simply a rollback to revert the bpo-39207 change. It was a performance enhancement, but it causes a new deadlock in code that didn't already have one when thread tuned malloc implementations are used.

The only way to safely launch worker processes on demand is to spawn a worker launcher process spawned prior to any thread creation that remains idle, with a sole job of spawn new worker processes for us. That sounds complicated. That'd be a feature. Lets go with the bugfix first.
History
Date User Action Args
2022-01-21 23:59:53gregory.p.smithsetrecipients: + gregory.p.smith, yilei
2022-01-21 23:59:53gregory.p.smithsetmessageid: <1642809593.03.0.696330770978.issue46464@roundup.psfhosted.org>
2022-01-21 23:59:53gregory.p.smithlinkissue46464 messages
2022-01-21 23:59:52gregory.p.smithcreate