Visitar URL original
`test_import.test_concurrency` leaks ref on Windows · Issue #106176 · python/cpython · GitHub
Skip to content

test_import.test_concurrency leaks ref on Windows #106176

Description

@sunmy2019

On Python 3.12, test_import.test_concurrency() leaks on Windows:

vstinner@WIN C:\victor\python\3.12>python -m test test_import -m test_concurrency -R 3:3
(...)
test_import leaked [22, 36, 28] references, sum=86

bisected to #94504

Potentially Related: #104702

See #102251 (comment) #104796 (comment)

Linked PRs

Activity

  1. vstinner commented on Jun 28, 2023

    @vstinner
    Member

    This leak can be seen on the "AMD64 Windows11 Refleaks 3.12" buildbot for example: https://buildbot.python.org/all/#/builders/1103/builds/36

    I reproduced it locally.

  2. vstinner commented on Jun 28, 2023

    @vstinner
    Member
  3. Eclips4 commented on Jun 28, 2023

    @Eclips4
    Member

    On Python 3.12, test_import.test_concurrency() leaks on Windows:

    Did you mean that this test leaks only on 3.12?
    I can still reproduce it on current main branch (3.13).

    More info
    ./python -m test test_import -m test_concurrency -R 3:3
    Running debug|x64 interpreter...
    0:00:00 Run tests sequentially
    0:00:00 [1/1] test_import
    beginning 6 repetitions
    123456
    ......
    test_import leaked [40, 40, 40] references, sum=120
    test_import leaked [40, 40, 40] memory blocks, sum=120
    test_import failed (reference leak)
    
    == Tests result: FAILURE ==
    
    1 test failed:
        test_import
    
    Total duration: 7.0 sec
    Tests result: FAILURE
  4. sunmy2019 commented on Jun 28, 2023

    @sunmy2019
    MemberAuthor

    Did you mean that this test leaks only on 3.12?

    No. It also affects 3.12

  5. exarkun commented on Jun 28, 2023

    @exarkun
    Contributor

    I'm not familiar with the leak checking system and I'm not likely to have much time to learn about it in the foreseeable future.

  6. added a commit that references this issue on Jun 28, 2023
  7. brettcannon commented on Jun 28, 2023

    @brettcannon
    Member

    @exarkun it just means some things are not getting cleaned up.

  8. exarkun commented on Jun 29, 2023

    @exarkun
    Contributor

    Just trying to signal my likelihood of pitching on here: low.

  9. vstinner commented on Jul 23, 2023

    @vstinner
    Member

    Oops, I just reported a duplicate of this bug: #107086 (closed).

    I also found the same commit with git bisect: commit 3325f05

    commit 3325f054e33b318aa56b74472f76a56b8afc0510
    Author: Jean-Paul Calderone <exarkun@twistedmatrix.com>
    Date:   Fri Jan 20 19:00:39 2023 -0500
    
        gh-91351: Fix some bugs in importlib handling of re-entrant imports (GH-94504)
    
        Co-authored-by: Brett Cannon <brett@python.org>
    
  10. vstinner commented on Jul 23, 2023

    @vstinner
    Member

    A fix was proposed: PR #106207.

  11. erlend-aasland commented on Aug 1, 2023

    @erlend-aasland
    Contributor

    @Yhg1s: IMO, this is also a release blocker (in my opinion, any ref leak is a release blocker).

  12. Yhg1s commented on Aug 1, 2023

    @Yhg1s
    Member

    (Yes, this looks like a real leak, not an artifact of how the refleak checker reruns things, so it should be a release blocker.)

  13. brettcannon commented on Aug 2, 2023

    @brettcannon
    Member

    We could revert the fix that leads to the leak to unblock the release as I'm not sure if anyone has come up with a good solution to avoid the memory leak and the bugs that get fixed are not fundamental to import (although it would still be nice to have the bugs fixed).

  14. added a commit that references this issue on Aug 25, 2023
  15. brettcannon commented on Aug 25, 2023

    @brettcannon
    Member

    I created #108497 to try out an idea that @Eclips4 had for using weakrefs.

  16. added a commit that references this issue on Aug 29, 2023
  17. added a commit that references this issue on Aug 29, 2023
  18. added a commit that references this issue on Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions