Gregory P. Smith <g...@krypto.org> added the comment:

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.

----------
assignee:  -> gregory.p.smith
keywords: +3.9regression
nosy: +gregory.p.smith
stage:  -> needs patch
type:  -> resource usage

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46464>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to