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

Memory Leak - ThreadingUDPServer #81570

Closed
danfdataforgeonca mannequin opened this issue Jun 24, 2019 · 3 comments
Closed

Memory Leak - ThreadingUDPServer #81570

danfdataforgeonca mannequin opened this issue Jun 24, 2019 · 3 comments
Labels
3.7 (EOL) end of life performance Performance or resource usage stdlib Python modules in the Lib dir

Comments

@danfdataforgeonca
Copy link
Mannequin

danfdataforgeonca mannequin commented Jun 24, 2019

BPO 37389
Nosy @vstinner
Superseder
  • bpo-37193: Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn
  • 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 2019-06-24.15:01:07.218>
    created_at = <Date 2019-06-24.14:53:55.531>
    labels = ['3.7', 'library', 'performance']
    title = 'Memory Leak - ThreadingUDPServer'
    updated_at = <Date 2019-06-24.15:01:07.213>
    user = 'https://bugs.python.org/danfdataforgeonca'

    bugs.python.org fields:

    activity = <Date 2019-06-24.15:01:07.213>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-24.15:01:07.218>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2019-06-24.14:53:55.531>
    creator = 'danf@dataforge.on.ca'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37389
    keywords = []
    message_count = 3.0
    messages = ['346410', '346411', '346412']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'danf@dataforge.on.ca']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '37193'
    type = 'performance'
    url = 'https://bugs.python.org/issue37389'
    versions = ['Python 3.7']

    @danfdataforgeonca
    Copy link
    Mannequin Author

    danfdataforgeonca mannequin commented Jun 24, 2019

    After putting a basic ThreadingUDPServer under load (500 messages per/second) I noticed that after a night it was consuming a lot of RAM given it does nothing with the data.

    On inception, I noticed the _thread count inside the server was growing forever even though the sub-threads are done.

    Setup a basic ThreadingUDPSever with handler that does nothing and check the request_queue_size, it seems to grow without limit.

    @danfdataforgeonca danfdataforgeonca mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir performance Performance or resource usage labels Jun 24, 2019
    @danfdataforgeonca
    Copy link
    Mannequin Author

    danfdataforgeonca mannequin commented Jun 24, 2019

    The only way I could figure out to control it was to do this in a thread;

            for thread in server._threads:  # type: Thread
                if not thread.is_alive():
                    server._threads.remove(thread)

    Shouldn't the server process do this when the thread is done?

    @vstinner
    Copy link
    Member

    This issue is a duplicate of bpo-37193.

    @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.7 (EOL) end of life performance Performance or resource usage stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant