[issue36780] Interpreter exit blocks waiting for futures of shut-down ThreadPoolExecutors

Hrvoje Nikšić report at bugs.python.org
Tue Apr 14 14:15:17 EDT 2020


Hrvoje Nikšić <hniksic at gmail.com> added the comment:

> I don't think there's much ThreadPoolExecutor can do.  If you drop the references to the threads, they still exist and they still be waited upon at interpreter exit.

ThreadPoolExecutor introduces additional waiting of its own, and it is this wait the PR adds an option to disable.

> The solution is for you to avoid having hanging threads.

In some cases that is not possible. For example, the file IO on network file systems can take an arbitrary amount of time, and there is no way to implement a timeout. DNS lookups have been notorious for not supporting timeouts. Many third-party libraries, such as database drivers, still don't support timeouts.

This is a real issue that bit many users in production systems, it's not about a toy program using "home-baked networking code".

----------

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


More information about the Python-bugs-list mailing list