cagney <andrew.cag...@gmail.com> added the comment:

So:

#1 we've a bug: the single-threaded ProcessPoolExecutor test program should 
work 100% reliably - it does not

#2 we've a cause: ProcessPoolExecutor is implemented internally using an 
unfortunate combination of fork and threads, this is causing the deadlock

#3 we've got a workaround - something like:
   ProcessPoolExecutor(multiprocessing.get_context('spawn'))
but I'm guessing, the documentation is scant.

As for a fix, maybe:
- have ProcessPoolExecutor use 'spawn' by default; this way things always work
- have ProcessPoolExecutor properly synchronized its threads before 
"spawning"/"forking"/... so that "single-threaded" code works
- document that combining ProcessPoolExecutor's "fork" option and user threads 
isn't a good idea

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35866>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to