Open
Description
The test_3_join_in_forked_from_thread
test case in test_threading.py
may call fork during shutdown:
cpython/Lib/test/test_threading.py
Lines 1273 to 1275 in 113053a
The relevant code looks like:
def worker():
childpid = os.fork()
...
w = threading.Thread(target=worker)
w.start()
The interpreter starts shutting down immediately after w.start()
. In the default build, this is usually OK because the GIL switching interval (and limited eval breaker checks) means that the os.fork()
call likely happens before the w.start()
returns, but there is no guarantee of that. In the free-threaded build, this is much more likely to raise a PythonFinalizationError: can't fork at interpreter shutdown
error because the w.start()
call returns more quickly.
See also #114570