[issue42097] Python 3.7.9 logging/threading/fork hang

Gregory P. Smith report at bugs.python.org
Wed Oct 21 23:59:17 EDT 2020


Gregory P. Smith <greg at krypto.org> added the comment:

If you use os.fork() or any of the multiprocessing start methods that call os.fork() with a process involving threads, this is expected behavior.  os.fork() cannot be used in processes that have threads without potential for deadlock.

Specifically, make sure you explicitly call:

 multiprocessing.set_start_method('spawn')

before using multiprocessing in any application where threads exist.

It is possible to use 'forkserver' as well, but only if you ensure the multiprocessing forkserver process is started before your application has launched any threads.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42097>
_______________________________________


More information about the Python-bugs-list mailing list