Martin Ritter added the comment:

I agree that this is error prone and can not be fixed reliably on the python 
side. However, python makes it very easy to mix these two, a user might not 
even notice it if a function he calls uses fork and thus just use a 
ThreadPoolExecutor() because it's the simplest thing to do.

What could be an nice solution in my opinion if the multiprocessing module 
could check if there are already multiple threads active on process creation 
and issue a warning if so. This warning could of course be optional but would 
make this issue more obvious.

In my case we have a large C++ code base which still includes a lot of Fortran 
77 code with common blocks all over the place (yay science). Everything is 
interfaced in python so to make sure that I do not have any side effects I run 
the some of the functions in a fork using multiprocessing.Process(). And in 
this case I just wanted to run some testing in parallel. I now switched to a 
ProcessPoolExecutor which works fine but for me.

----------

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

Reply via email to