Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thread timeout for loop.shutdown_default_executor #82448

Closed
aeros opened this issue Sep 24, 2019 · 1 comment · Fixed by #97561
Closed

Add thread timeout for loop.shutdown_default_executor #82448

aeros opened this issue Sep 24, 2019 · 1 comment · Fixed by #97561
Assignees
Labels
3.12 bugs and security fixes topic-asyncio type-feature A feature request or enhancement

Comments

@aeros
Copy link
Contributor

aeros commented Sep 24, 2019

BPO 38267
Nosy @asvetlov, @1st1, @aeros
PRs
  • bpo-38267: Add thread timeout parameter to loop.shutdown_default_executor() #16360
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2019-09-24.19:31:44.204>
    labels = ['3.9']
    title = 'Add thread timeout for loop.shutdown_default_executor'
    updated_at = <Date 2019-09-24.20:23:27.554>
    user = 'https://github.com/aeros'

    bugs.python.org fields:

    activity = <Date 2019-09-24.20:23:27.554>
    actor = 'aeros'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2019-09-24.19:31:44.204>
    creator = 'aeros'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38267
    keywords = ['patch']
    message_count = 1.0
    messages = ['353115']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'yselivanov', 'aeros']
    pr_nums = ['16360']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue38267'
    versions = ['Python 3.9']

    @aeros
    Copy link
    Contributor Author

    aeros commented Sep 24, 2019

    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 #60488.

    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().

    @aeros aeros added the 3.9 only security fixes label Sep 24, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @kumaraditya303 kumaraditya303 added 3.12 bugs and security fixes and removed 3.9 only security fixes labels Sep 26, 2022
    @kumaraditya303 kumaraditya303 self-assigned this Sep 26, 2022
    @kumaraditya303 kumaraditya303 added the type-feature A feature request or enhancement label Sep 26, 2022
    gvanrossum pushed a commit that referenced this issue Sep 28, 2022
    Co-authored-by: Kyle Stanley <aeros167@gmail.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.12 bugs and security fixes topic-asyncio type-feature A feature request or enhancement
    Projects
    Status: Done
    Development

    Successfully merging a pull request may close this issue.

    2 participants