mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads (GH-126098)
Threads are gone after fork, so clear the queues too. Otherwise the child process (here created via multiprocessing.Process) crashes on interpreter exit. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
7725c0371a
commit
1848ce61f3
3 changed files with 22 additions and 0 deletions
|
@ -41,6 +41,7 @@ if hasattr(os, 'register_at_fork'):
|
|||
os.register_at_fork(before=_global_shutdown_lock.acquire,
|
||||
after_in_child=_global_shutdown_lock._at_fork_reinit,
|
||||
after_in_parent=_global_shutdown_lock.release)
|
||||
os.register_at_fork(after_in_child=_threads_queues.clear)
|
||||
|
||||
|
||||
class WorkerContext:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue