Message391996
Hi all! While browsing StackOverflow I came across this question: https://stackoverflow.com/q/67273533/2111778 The user created a ThreadPoolExecutor which started a Process using multiprocessing. The Process produces an exitcode of 0 in Python 3.8 but an exitcode of 1 in Python 3.9. I'm really not familiar with Python internals, but through monkey-patching Lib/concurrent/futures/thread.py I was able to pin this regression down to the change of > atexit.register(_python_exit) to > threading._register_atexit(_python_exit) which led me to this issue! (: I know that multiprocessing in Python is a little funky, since I worked with it on my Master's thesis. I think the entire process gets forked (i.e. copied), so the child process also gets a copy of the active ThreadPoolExecutor, which I think causes some sort of problem there. Note that this behavior seems to differ based on OS. I can confirm the issue on Linux with the 'fork' method and disconfirm it with the 'spawn' and 'forkserver' methods. https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods Could someone with more insight kindly take a look at this? Greetings Jan <3 | |
| Date | User | Action | Args | | 2021-04-26 23:08:54 | janfrederik.konopka | set | recipients: + janfrederik.konopka, pitrou, vstinner, tomMoral, aeros | | 2021-04-26 23:08:53 | janfrederik.konopka | set | messageid: <1619478533.94.0.0540746427519.issue39812@roundup.psfhosted.org> | | 2021-04-26 23:08:53 | janfrederik.konopka | link | issue39812 messages | | 2021-04-26 23:08:53 | janfrederik.konopka | create | | |