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

Antoine Pitrou report at bugs.python.org
Tue Apr 14 14:02:43 EDT 2020


Antoine Pitrou <solipsis at pitrou.net> 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.

The solution is for you to avoid having hanging threads.  In the particular case of TCP connections, I'd recommend using a dedicated framework such as asyncio (or Twisted, Tornado, etc.) instead of home-baked networking code.

Also, note that Python sockets have a feature called *timeouts*.

----------

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


More information about the Python-bugs-list mailing list