Skip to content

Ref leaks on test_import #107471

Closed
Closed

Description

@sunmy2019
./python -m test -R : test_import
0:00:00 load avg: 0.27 Run tests sequentially
0:00:00 load avg: 0.27 [1/1] test_import
beginning 9 repetitions
123456789
.........
test_import leaked [60, 60, 60, 60] references, sum=240
test_import leaked [48, 48, 48, 48] memory blocks, sum=192
test_import failed (reference leak)

== Tests result: FAILURE ==

1 test failed:
    test_import

Total duration: 14.8 sec
Tests result: FAILURE

tested on heads/main:a24e25d74b

This result is also seen in many build bots,

such as

https://buildbot.python.org/all/#/builders/562/builds/838 https://buildbot.python.org/all/#/builders/123/builds/802 https://buildbot.python.org/all/#/builders/562/builds/838 https://buildbot.python.org/all/#/builders/384/builds/829

Linked PRs

Activity

  1. sunmy2019 commented on Jul 31, 2023

    @sunmy2019
    MemberAuthor

    bisected to 75c974f #107184

  2. Eclips4 commented on Jul 31, 2023

    @Eclips4
    Member

    Also, test_disallowed_reimport fails with segfault if we run his with --forever parameter:

    cpython % ./python.exe -m test -v  test_import -m test_disallowed_reimport --forever
    == CPython 3.13.0a0 (heads/main:3979150a0d, Jul 31 2023, 11:09:08) [Clang 14.0.3 (clang-1403.0.22.14.1)]
    == macOS-13.5-arm64-arm-64bit little-endian
    == Python build: debug
    == cwd: /Users/admin/Projects/cpython/build/test_python_1319æ
    == CPU count: 8
    == encodings: locale=UTF-8, FS=utf-8
    0:00:00 load avg: 1.57 Run tests sequentially
    0:00:00 load avg: 1.57 [  1] test_import
    test_disallowed_reimport (test.test_import.SubinterpImportTests.test_disallowed_reimport) ... ok
    
    ----------------------------------------------------------------------
    Ran 1 test in 0.010s
    
    OK
    0:00:00 load avg: 1.57 [  2] test_import
    test_disallowed_reimport (test.test_import.SubinterpImportTests.test_disallowed_reimport) ... Debug memory block at address p=0x104ad4770: API '�'
        15987178197214944733 bytes originally requested
        The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
            at p-7: 0xdd *** OUCH
            at p-6: 0xdd *** OUCH
            at p-5: 0xdd *** OUCH
            at p-4: 0xdd *** OUCH
            at p-3: 0xdd *** OUCH
            at p-2: 0xdd *** OUCH
            at p-1: 0xdd *** OUCH
        Because memory is corrupted at the start, the count of bytes requested
           may be bogus, and checking the trailing pad bytes may segfault.
        The 8 pad bytes at tail=0xdddddddee28b254d are Fatal Python error: Segmentation fault
    
    Current thread 0x00000001ec922080 (most recent call first):
      File "/Users/admin/Projects/cpython/Lib/test/test_import/__init__.py", line 153 in restore__testsinglephase
      File "/Users/admin/Projects/cpython/Lib/test/test_import/__init__.py", line 165 in meth
      File "/Users/admin/Projects/cpython/Lib/unittest/case.py", line 589 in _callTestMethod
      File "/Users/admin/Projects/cpython/Lib/unittest/case.py", line 634 in run
      File "/Users/admin/Projects/cpython/Lib/unittest/case.py", line 690 in __call__
      File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 122 in run
      File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 84 in __call__
      File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 122 in run
      File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 84 in __call__
      File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 122 in run
      File "/Users/admin/Projects/cpython/Lib/unittest/suite.py", line 84 in __call__
      File "/Users/admin/Projects/cpython/Lib/unittest/runner.py", line 240 in run
      File "/Users/admin/Projects/cpython/Lib/test/support/__init__.py", line 1115 in _run_suite
      File "/Users/admin/Projects/cpython/Lib/test/support/__init__.py", line 1241 in run_unittest
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/runtest.py", line 294 in _test_module
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/runtest.py", line 330 in _runtest_inner2
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/runtest.py", line 373 in _runtest_inner
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/runtest.py", line 248 in _runtest
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/runtest.py", line 278 in runtest
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 483 in run_tests_sequential
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 621 in run_tests
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 799 in _main
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 758 in main
      File "/Users/admin/Projects/cpython/Lib/test/libregrtest/main.py", line 822 in main
      File "/Users/admin/Projects/cpython/Lib/test/__main__.py", line 2 in <module>
      File "/Users/admin/Projects/cpython/Lib/runpy.py", line 88 in _run_code
      File "/Users/admin/Projects/cpython/Lib/runpy.py", line 198 in _run_module_as_main
    
    Extension modules: _testcapi, _testinternalcapi, _testsinglephase, _testmultiphase, _xxsubinterpreters (total: 5)
    zsh: segmentation fault  ./python.exe -m test -v test_import -m test_disallowed_reimport --forever
  3. added a commit that references this issue on Aug 2, 2023
  4. added a commit that references this issue on Aug 2, 2023
  5. added a commit that references this issue on Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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