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

test_threading is leaking references #81307

Closed
pablogsal opened this issue Jun 1, 2019 · 8 comments
Closed

test_threading is leaking references #81307

pablogsal opened this issue Jun 1, 2019 · 8 comments
Labels
3.8 (EOL) end of life tests Tests in the Lib/test dir

Comments

@pablogsal
Copy link
Member

BPO 37126
Nosy @vstinner, @ambv, @pablogsal
PRs
  • bpo-37126: Allow structseq objects to be tracked by the GC #13729
  • bpo-37126: Call PyObject_GC_UnTrack in structseq dealloc #13751
  • 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-02.21:15:11.918>
    created_at = <Date 2019-06-01.17:00:48.642>
    labels = ['3.8', 'tests']
    title = 'test_threading is leaking references'
    updated_at = <Date 2019-06-02.21:15:11.917>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2019-06-02.21:15:11.917>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-02.21:15:11.918>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2019-06-01.17:00:48.642>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37126
    keywords = ['patch']
    message_count = 8.0
    messages = ['344191', '344195', '344197', '344209', '344289', '344309', '344310', '344320']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'lukasz.langa', 'pablogsal']
    pr_nums = ['13729', '13751']
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue37126'
    versions = ['Python 3.8']

    @pablogsal
    Copy link
    Member Author

    https://buildbot.python.org/all/#/builders/1/builds/601

    OK (skipped=1)
    .
    test_threading leaked [9770, 9772, 9768] references, sum=29310
    test_threading leaked [3960, 3961, 3959] memory blocks, sum=11880
    2 tests failed again:
    test_asyncio test_threading

    @pablogsal pablogsal added 3.8 (EOL) end of life tests Tests in the Lib/test dir labels Jun 1, 2019
    @pablogsal
    Copy link
    Member Author

    ❯ ./python -m test test_threading -m test_excepthook_thread_None -R :
    Run tests sequentially
    0:00:00 load avg: 1.38 [1/1] test_threading
    beginning 9 repetitions
    123456789
    .........
    test_threading leaked [364, 364, 364, 364] references, sum=1456
    test_threading leaked [164, 164, 164, 164] memory blocks, sum=656
    test_threading failed

    == Tests result: FAILURE ==

    1 test failed:
    test_threading

    Total duration: 159 ms
    Tests result: FAILURE

    @pablogsal
    Copy link
    Member Author

    The problem here is that there is a reference cycle with threading.ExceptHookArgs but structseq objects are not tracked by the GC.

    @pablogsal
    Copy link
    Member Author

    Łukasz, this PR will fix the x86 Gentoo Refleaks 3.x and friends, so I would recommend landing this before the release.

    @pablogsal
    Copy link
    Member Author

    New changeset 7ffcf84 by Pablo Galindo in branch 'master':
    bpo-37126: Allow structseq objects to be tracked by the GC (GH-13729)
    7ffcf84

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2019

    You forgot to call PyObject_GC_UnTrack() in structseq_dealloc(), no?

    @vstinner vstinner reopened this Jun 2, 2019
    @pablogsal
    Copy link
    Member Author

    You forgot to call PyObject_GC_UnTrack() in structseq_dealloc(), no?

    Yep, thanks for the catch!

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2019

    Thanks.

    commit 3caf4de
    Author: Pablo Galindo <Pablogsal@gmail.com>
    Date: Sun Jun 2 21:52:49 2019 +0100

    Call PyObject_GC_UnTrack in structseq dealloc (GH-13751)
    

    --

    FYI I also fixed test_threading:

    commit cdce057
    Author: Victor Stinner <vstinner@redhat.com>
    Date: Sun Jun 2 23:08:41 2019 +0200

    bpo-36829: test_threading: Fix a ref cycle (GH-13752)
    

    @vstinner vstinner closed this as completed Jun 2, 2019
    @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.8 (EOL) end of life tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants