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 leaked [1, 1, 1] references: test_threads_join #82357

Closed
vstinner opened this issue Sep 15, 2019 · 3 comments
Closed

test_threading leaked [1, 1, 1] references: test_threads_join #82357

vstinner opened this issue Sep 15, 2019 · 3 comments
Assignees
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 38176
Nosy @vstinner, @DinoV
PRs
  • bpo-38176: Fix missing dec ref #16158
  • 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 = 'https://github.com/DinoV'
    closed_at = <Date 2019-09-15.14:52:17.172>
    created_at = <Date 2019-09-15.09:48:19.686>
    labels = ['library', '3.9']
    title = 'test_threading leaked [1, 1, 1] references: test_threads_join'
    updated_at = <Date 2019-09-16.08:07:17.255>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-09-16.08:07:17.255>
    actor = 'vstinner'
    assignee = 'dino.viehland'
    closed = True
    closed_date = <Date 2019-09-15.14:52:17.172>
    closer = 'dino.viehland'
    components = ['Library (Lib)']
    creation = <Date 2019-09-15.09:48:19.686>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38176
    keywords = ['patch']
    message_count = 3.0
    messages = ['352470', '352471', '352527']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'dino.viehland']
    pr_nums = ['16158']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue38176'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    vstinner@apu$ ./python -m test -R 3:3 test_threading -m test.test_threading.SubinterpThreadingTests.test_threads_join
    Run tests sequentially
    0:00:00 load avg: 1.11 [1/1] test_threading
    beginning 6 repetitions
    123456
    ......
    test_threading leaked [1, 1, 1] references, sum=3
    test_threading failed

    == Tests result: FAILURE ==

    1 test failed:
    test_threading

    Total duration: 639 ms
    Tests result: FAILURE

    @vstinner vstinner added 3.9 only security fixes stdlib Python modules in the Lib dir labels Sep 15, 2019
    @vstinner
    Copy link
    Member Author

    The regression seems to be introduced by:

    commit 04f0bbf (HEAD, refs/bisect/bad)
    Author: Dino Viehland <dinoviehland@fb.com>
    Date: Fri Sep 13 11:12:27 2019 +0100

    bpo-38075: Port _randommodule.c to PEP-384 (GH-15798)
    
    - Migrate `Random_Type` to `PyType_FromSpec`
    - To simulate an old use of `PyLong_Type.tp_as_number->nb_absolute`, I added
      code to the module init function to stash `int.__abs__` for later
      use. Ideally we'd use `PyType_GetSlot()` instead, but it doesn't currently
      work for static types in CPython, and implementing it just for this case
      doesn't seem worth it.
    - Do exact check for long and dispatch to PyNumber_Absolute, use vector call when not exact.
    

    @DinoV DinoV self-assigned this Sep 15, 2019
    @DinoV DinoV closed this as completed Sep 15, 2019
    @vstinner
    Copy link
    Member Author

    commit 09dc2c6
    Author: Dino Viehland <dinoviehland@gmail.com>
    Date: Sun Sep 15 15:51:44 2019 +0100

    Fix missing dec ref (bpo-16158)
    
    diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c
    index 8b0a0244bf..1ea2bf28ab 100644
    --- a/Modules/_randommodule.c
    +++ b/Modules/_randommodule.c
    @@ -572,6 +572,7 @@ static int
     _random_clear(PyObject *module)
     {
         Py_CLEAR(_randomstate(module)->Random_Type);
    +    Py_CLEAR(_randomstate(module)->Long___abs__);
         return 0;
     }

    @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 stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants