Skip to content

Conversation

@gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Sep 20, 2025

@gaogaotiantian
Copy link
Member Author

@hugovk should we wait until 3.14.0 release to backport this?

@gaogaotiantian
Copy link
Member Author

Hey @iritkatriel do you mind reviewing this again? I realized rlcompleter messes with the completer when it’s first imported, which was not ideal but we probably need to keep it for compatibility. So I made a workaround to import it early.

@gaogaotiantian gaogaotiantian merged commit c8624cd into python:main Sep 24, 2025
45 checks passed
@miss-islington-app
Copy link

Thanks @gaogaotiantian for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@gaogaotiantian gaogaotiantian deleted the fix-rlcompleter-import branch September 24, 2025 03:46
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 24, 2025
@miss-islington-app
Copy link

Sorry, @gaogaotiantian, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker c8624cd36746b17d8f991cde63705e9419e940de 3.13

@bedevere-app
Copy link

bedevere-app bot commented Sep 24, 2025

GH-139280 is a backport of this pull request to the 3.14 branch.

@bedevere-app
Copy link

bedevere-app bot commented Sep 24, 2025

GH-139281 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Sep 24, 2025
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL9 Refleaks 3.x (tier-3) has failed when building commit c8624cd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1589/builds/2178) and take a look at the build logs.
  4. Check if the failure is related to this commit (c8624cd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1589/builds/2178

Failed tests:

  • test_external_inspection
  • test_zipimport

Failed subtests:

  • test_only_active_thread - test.test_external_inspection.TestGetStackTrace.test_only_active_thread

Test leaking resources:

  • test_zipimport: references
  • test_zipimport: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (test.test_zipimport.ZStdCompressedZipImportTestCase.testTraceback) ... skipped 'requires zstd'


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-rhel9-s390x.refleak/build/Lib/test/test_external_inspection.py", line 1639, in test_only_active_thread
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        total_gil_threads, 1, "Should have exactly one GIL holder"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: 0 != 1 : Should have exactly one GIL holder


Traceback (test.test_zipimport.DeflateCompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL8 Refleaks 3.x (tier-3) has failed when building commit c8624cd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/75/builds/3381) and take a look at the build logs.
  4. Check if the failure is related to this commit (c8624cd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/75/builds/3381

Failed tests:

  • test_external_inspection
  • test_zipimport

Failed subtests:

  • test_only_active_thread - test.test_external_inspection.TestGetStackTrace.test_only_active_thread

Test leaking resources:

  • test_zipimport: references
  • test_zipimport: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (test.test_zipimport.ZStdCompressedZipImportTestCase.testTraceback) ... skipped 'requires zstd'


Traceback (test.test_zipimport.DeflateCompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-rhel8-s390x.refleak/build/Lib/test/test_external_inspection.py", line 1639, in test_only_active_thread
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        total_gil_threads, 1, "Should have exactly one GIL holder"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: 0 != 1 : Should have exactly one GIL holder

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 CentOS9 NoGIL Refleaks 3.x (tier-1) has failed when building commit c8624cd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1610/builds/2115) and take a look at the build logs.
  4. Check if the failure is related to this commit (c8624cd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1610/builds/2115

Failed tests:

  • test.test_asyncio.test_events
  • test_zipimport

Failed subtests:

  • test_create_connection_local_addr_skip_different_family - test.test_asyncio.test_events.PollEventLoopTests.test_create_connection_local_addr_skip_different_family

Test leaking resources:

  • test_zipimport: references
  • test_zipimport: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (test.test_zipimport.ZStdCompressedZipImportTestCase.testTraceback) ... skipped 'requires zstd'


Traceback (test.test_zipimport.DeflateCompressedZipImportTestCase.testTraceback) ... ok


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.itamaro-centos-aws.refleak.nogil/build/Lib/asyncio/selector_events.py", line 873, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: unclosed transport <_SelectorSocketTransport fd=5>
Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket fd=5, family=2, type=1, proto=6, laddr=('127.0.0.1', 55377), raddr=('127.0.0.1', 55377)>:
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.itamaro-centos-aws.refleak.nogil/build/Lib/test/support/__init__.py", line 837, in gc_collect
    gc.collect()
    ~~~~~~~~~~^^
ResourceWarning: unclosed <socket.socket fd=5, family=2, type=1, proto=6, laddr=('127.0.0.1', 55377), raddr=('127.0.0.1', 55377)>


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.itamaro-centos-aws.refleak.nogil/build/Lib/test/test_asyncio/test_events.py", line 811, in test_create_connection_local_addr_skip_different_family
    with self.assertRaises(OSError):
         ~~~~~~~~~~~~~~~~~^^^^^^^^^
AssertionError: OSError not raised

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 FreeBSD Refleaks 3.x (tier-3) has failed when building commit c8624cd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1613/builds/2042) and take a look at the build logs.
  4. Check if the failure is related to this commit (c8624cd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1613/builds/2042

Failed tests:

  • test.test_multiprocessing_forkserver.test_processes
  • test_zipimport

Failed subtests:

  • test_interrupt - test.test_multiprocessing_forkserver.test_processes.WithProcessesTestProcess.test_interrupt

Test leaking resources:

  • test_zipimport: references
  • test_zipimport: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (test.test_zipimport.DeflateCompressedZipImportTestCase.testTraceback) ... ok


Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/multiprocessing/process.py", line 320, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/_test_multiprocessing.py", line 524, in _sleep_some_event
    time.sleep(100)
    ~~~~~~~~~~^^^^^
KeyboardInterrupt
k


Traceback (most recent call last):
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/_test_multiprocessing.py", line 596, in test_interrupt
    exitcode = self._kill_process(multiprocessing.Process.interrupt)
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/_test_multiprocessing.py", line 577, in _kill_process
    self.assertEqual(join(), None)
                     ~~~~^^
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/_test_multiprocessing.py", line 250, in __call__
    return self.func(*args, **kwds)
           ~~~~~~~~~^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/multiprocessing/process.py", line 156, in join
    res = self._popen.wait(timeout)
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/multiprocessing/popen_fork.py", line 44, in wait
    return self.poll(os.WNOHANG if timeout == 0.0 else 0)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/multiprocessing/popen_forkserver.py", line 65, in poll
    if not wait([self.sentinel], timeout):
           ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/multiprocessing/connection.py", line 1165, in wait
    ready = selector.select(timeout)
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/selectors.py", line 398, in select
    fd_event_list = self._selector.poll(timeout)
  File "/buildbot/buildarea/3.x.ware-freebsd.refleak/build/Lib/test/_test_multiprocessing.py", line 573, in handler
    raise RuntimeError('join took too long: %s' % p)
RuntimeError: join took too long: <Process name='Process-1374' pid=100 parent=95980 started daemon>


Traceback (test.test_zipimport.ZStdCompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot ARM64 MacOS M1 Refleaks NoGIL 3.x (tier-2) has failed when building commit c8624cd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1368/builds/3899) and take a look at the build logs.
  4. Check if the failure is related to this commit (c8624cd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1368/builds/3899

Failed tests:

  • test_zipimport

Test leaking resources:

  • test_zipimport: references
  • test_zipimport: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (test.test_zipimport.ZStdCompressedZipImportTestCase.testTraceback) ... skipped 'requires zstd'


Traceback (test.test_zipimport.DeflateCompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok

@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 Fedora Stable Refleaks 3.x (tier-1) has failed when building commit c8624cd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/320/builds/3063) and take a look at the build logs.
  4. Check if the failure is related to this commit (c8624cd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/320/builds/3063

Failed tests:

  • test_zipimport

Test leaking resources:

  • test_zipimport: references
  • test_zipimport: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (test.test_zipimport.DeflateCompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.ZStdCompressedZipImportTestCase.testTraceback) ... ok


Traceback (test.test_zipimport.UncompressedZipImportTestCase.testTraceback) ... ok

gaogaotiantian added a commit that referenced this pull request Sep 24, 2025
#139281)

[3.13] gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185)
(cherry picked from commit c8624cd)
encukou pushed a commit that referenced this pull request Oct 10, 2025
… subprocess (GH-139185) (GH-139305) (GH-139280)

* gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185)
(cherry picked from commit c8624cd)

* gh-139289: Lazy import rlcompleter to fix the refleak (GH-139305)
(cherry picked from commit 8288f36)

Co-authored-by: Tian Gao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants