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

Set the thread_name_prefix for asyncio's default executor ThreadPoolExecutor #83790

Closed
mmohrhard mannequin opened this issue Feb 11, 2020 · 4 comments
Closed

Set the thread_name_prefix for asyncio's default executor ThreadPoolExecutor #83790

mmohrhard mannequin opened this issue Feb 11, 2020 · 4 comments
Labels
3.9 only security fixes topic-asyncio type-feature A feature request or enhancement

Comments

@mmohrhard
Copy link
Mannequin

mmohrhard mannequin commented Feb 11, 2020

BPO 39609
Nosy @asvetlov, @cjrh, @1st1, @miss-islington, @mmohrhard
PRs
  • bpo-39609: set the thread_name_prefix for the default asyncio executor #18458
  • 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 = <Date 2020-02-27.20:02:17.477>
    created_at = <Date 2020-02-11.11:35:18.867>
    labels = ['type-feature', '3.9', 'expert-asyncio']
    title = "Set the thread_name_prefix for asyncio's default executor ThreadPoolExecutor"
    updated_at = <Date 2020-02-27.20:02:17.477>
    user = 'https://github.com/mmohrhard'

    bugs.python.org fields:

    activity = <Date 2020-02-27.20:02:17.477>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-02-27.20:02:17.477>
    closer = 'asvetlov'
    components = ['asyncio']
    creation = <Date 2020-02-11.11:35:18.867>
    creator = 'Markus Mohrhard'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39609
    keywords = ['patch']
    message_count = 4.0
    messages = ['361799', '362162', '362177', '362832']
    nosy_count = 5.0
    nosy_names = ['asvetlov', 'cjrh', 'yselivanov', 'miss-islington', 'Markus Mohrhard']
    pr_nums = ['18458']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue39609'
    versions = ['Python 3.9']

    @mmohrhard
    Copy link
    Mannequin Author

    mmohrhard mannequin commented Feb 11, 2020

    The ThreadPoolExecutor in BaseEventLoop.run_in_executor should set a thread_name_prefix to simplify debugging.

    Might also be worth to limit the number of max threads. On our 256 core machines we sometimes get 1000+ threads due to the cpu_count() * 5 default limit.

    @mmohrhard mmohrhard mannequin added 3.9 only security fixes topic-asyncio type-feature A feature request or enhancement labels Feb 11, 2020
    @cjrh
    Copy link
    Mannequin

    cjrh mannequin commented Feb 17, 2020

    This change seems fine.

    Markus,

    I'm curious if there is a specific reason you prefer to use the default executor rather than replacing it with your own? Is it just convenience or are there other reasons?

    @mmohrhard
    Copy link
    Mannequin Author

    mmohrhard mannequin commented Feb 18, 2020

    We have by now changed to a custom executor. Asyncio is used in some of our dependencies and therefore it took some work to figure out what is creating the thousands of threads that we were seeing.

    This patch was part of the debuggin and we thought it would be useful for anyone else to immediately see what is creating the threads.

    @miss-islington
    Copy link
    Contributor

    New changeset 374d998 by Markus Mohrhard in branch 'master':
    bpo-39609: set the thread_name_prefix for the default asyncio executor (GH-18458)
    374d998

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes topic-asyncio type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants