Message411213
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. |
|
Date |
User |
Action |
Args |
2022-01-21 23:59:53 | gregory.p.smith | set | recipients:
+ gregory.p.smith, yilei |
2022-01-21 23:59:53 | gregory.p.smith | set | messageid: <1642809593.03.0.696330770978.issue46464@roundup.psfhosted.org> |
2022-01-21 23:59:53 | gregory.p.smith | link | issue46464 messages |
2022-01-21 23:59:52 | gregory.p.smith | create | |
|