[issue38267] Add thread timeout for loop.shutdown_default_executor

Kyle Stanley report at bugs.python.org
Tue Sep 24 15:31:44 EDT 2019


New submission from Kyle Stanley <aeros167 at gmail.com>:

Currently, for the recently added coroutine `loop.shutdown_default_executor()`, the executor shutdown can wait indefinitely for the threads to join. Under normal circumstances, waiting on the threads is appropriate, but there should be a timeout duration in the situation that the threads unable to finish joining. 

The motivation for this was based on the comments from Andrew Svetlov and Yury Selivanov in GH-16284.

The original idea from Andrew was to add the timeout duration as a default for a new parameter in `asyncio.run()` and `loop.shutdown_default_executor()`. However, Yury would prefer for this to be defined as a constant instead and not as a parameter for `asyncio.run()` to avoid the creation of an excessive number of parameters to tweak for the user.

I will attach a PR that adds the constant and the parameter for `loop.shutdown_default_executor()`, which will passed as an argument to `thread.join()`.

----------
messages: 353115
nosy: aeros167, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add thread timeout for loop.shutdown_default_executor
versions: Python 3.9

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


More information about the Python-bugs-list mailing list