Skip to content

test_basic_multiple_interpreters_deleted_no_reset() of test_imp/test_import leaks references #106000

Description

@vstinner

The test_basic_multiple_interpreters_deleted_no_reset() test of test_import (previously in test_imp) leaks references but only when test_import is run with -jN option:

The test leaks since it was added by the commit bb0cf8f at Feb 27.

Leak with -j1 option:

$ ./python -m test -j1 -R 3:3 test_import -m test_basic_multiple_interpreters_deleted_no_reset 
test_import leaked [10, 10, 10] references, sum=30

No leak without the -j1 option, magic!

$ ./python -m test -R 3:3 test_import -m test_basic_multiple_interpreters_deleted_no_reset 
(...)
Tests result: SUCCESS

cc @ericsnowcurrently

Activity

  1. vstinner commented on Jun 22, 2023

    @vstinner
    MemberAuthor

    The bug was not spotted by buildbots since the test fail when run with -jN option, but pass when regrtest main process re-runs the test in the same process:

    ./python -E  ./Tools/scripts/run_tests.py -j 1 -u all -W --slowest --fail-env-changed --timeout=11700 -R 3:3 -u-cpu -j40 
    == CPython 3.13.0a0 (heads/main:bd1b6228d1, May 26 2023, 02:34:01) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)]
    == Linux-6.2.14-300.fc38.aarch64-aarch64-with-glibc2.37 little-endian
    == Python build: debug
    == cwd: /home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.refleak/build/build/test_python_3001460æ
    == CPU count: 40
    == encodings: locale=UTF-8, FS=utf-8
    Using random seed 3314398
    0:00:00 load avg: 3.41 Run tests in parallel using 40 child processes (timeout: 3 hour 15 min, worker timeout: 3 hour 20 min)
    (...)
    0:00:50 load avg: 21.90 [150/449/1] test_import failed (reference leak) (32.7 sec) -- running: test_decimal (50.6 sec), test_lzma (36.9 sec), test_cmd_line_script (40.5 sec), test_xmlrpc (49.2 sec), test_selectors (46.9 sec), test.test_asyncio.test_subprocess (43.5 sec), test_weakref (33.9 sec), test_traceback (36.1 sec), test_venv (34.9 sec), test_buffer (42.8 sec), test_pdb (44.9 sec), test_socket (35.1 sec), test.test_asyncio.test_events (49.8 sec), test_support (40.4 sec), test.test_asyncio.test_futures (47.1 sec), test_multiprocessing_forkserver (34.2 sec), test_unicodedata (49.0 sec), test_tarfile (50.3 sec), test_imaplib (48.0 sec), test_cppext (50.3 sec), test_gdb (40.4 sec), test_exceptions (47.1 sec)
    beginning 6 repetitions
    123456
    ......
    test_import leaked [78, 80, 77] references, sum=235
    test_import leaked [67, 67, 66] memory blocks, sum=200
    (...)
    
    1 test failed:
        test_import
    
    (...)
    0:33:44 load avg: 0.08 Re-running test_import in verbose mode
    (...)
    OK (skipped=3)
    
    == Tests result: FAILURE then SUCCESS ==
    
    433 tests OK.
    
    1 re-run test:
        test_import
    

    regrtest should always spawn a subprocess to re-run tests in a clean environment.

  2. sunmy2019 commented on Jun 23, 2023

    @sunmy2019
    Member

    It is to be fixed by #104796

    when run with -jN option

    He let tests skipped if -R is in sys.args (with -j, -R will not be passed to the actual test). You can see my PR for details and ongoing discussions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions