[issue36780] Interpreter exit blocks waiting for futures of shut-down ThreadPoolExecutors
Hrvoje Nikšić
report at bugs.python.org
Tue Apr 14 16:01:55 EDT 2020
Hrvoje Nikšić <hniksic at gmail.com> added the comment:
> The only way I could see this to work as intended without making any changes to threading would be to optionally use daemon threads and avoid joining the threads in `executor.shutdown()` if `wait_at_exit` is set to False in the constructor for the executor.
Agreed, and that is precisely what I suggested in my previous comment. The attached PR already deals with the executor-specific part of the wait, but it would be straightforward to have it also affect the executor to create daemon threads, and the flag moved to the constructor.
> IMO, it also would require some fairly extensive testing to make sure it works as intended, which the patch currently lacks.
It is quite easy to check that a hanging thread (emulated by a simple sleep) is not joined by the executor with the appropriate flag set.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36780>
_______________________________________
More information about the Python-bugs-list
mailing list