This appears to be happening in a child process when the parent process is running:
Lib/multiprocessing/util.py, line 255, in _exit_function ()
Liberally adding printf() and getpid() calls in various places, seems to always happen when parent process is within "call_py_exitfuncs()" within Py_Finalize; error is from the child process that was created last.
Using gdb with a breakpoint on "call_py_exitfuncs" and single-stepping seems to confirm a single exitfunc:
Lib/multiprocessing/util.py, line 255, in _exit_function ()
and that the child dies as that bytecode function is executed.
$ ./python -c "import multiprocessing.managers ; mpp = multiprocessing.Pool(4); sm = multiprocessing.managers.SyncManager(); sm.start()"
Py_InitializeEx called for PID 27824
posix_fork called by PID 27824
child of posix_fork has PID 27825
posix_fork called by PID 27824
child of posix_fork has PID 27826
posix_fork called by PID 27824
child of posix_fork has PID 27827
posix_fork called by PID 27824
child of posix_fork has PID 27828
posix_fork called by PID 27824
child of posix_fork has PID 27832
Py_Finalize called for PID 27824
wait_for_thread_shutdown() finished for PID 27824
Fatal Python error for PID 27832: Invalid thread state for this thread
call_py_exitfuncs() finished for PID 27824
PyOS_FiniInterrupts() finished for PID 27824
[64240 refs] |