Skip to content

gh-145376: Fix refleak in _queuemodule.c out-of-memory path - #145543

Merged
kumaraditya303 merged 1 commit into
python:mainfrom
eendebakpt:refleak_queuemodule
Mar 7, 2026
Merged

gh-145376: Fix refleak in _queuemodule.c out-of-memory path#145543
kumaraditya303 merged 1 commit into
python:mainfrom
eendebakpt:refleak_queuemodule

Conversation

@eendebakpt

@eendebakpteendebakpt commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

@eendebakpteendebakpt changed the title gh-145376: Fix refleak in _queuemodule.cgh-145376: Fix refleak in _queuemodule.c out-of-memory pathMar 5, 2026

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The RingBuf_Put() comment says "Steals a reference to item".

@kumaraditya303
kumaraditya303 merged commit 0aeaaaf into python:mainMar 7, 2026
56 checks passed
@kumaraditya303kumaraditya303 added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Mar 7, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @eendebakpt for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @eendebakpt for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 7, 2026
…ythonGH-145543)
(cherry picked from commit 0aeaaaf)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 7, 2026
…ythonGH-145543)
(cherry picked from commit 0aeaaaf)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Mar 7, 2026
@bedevere-app

Copy link
Copy Markdown

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

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Mar 7, 2026
@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot AMD64 Ubuntu Shared 3.x (tier-1) has failed when building commit 0aeaaaf.

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/506/builds/12490) and take a look at the build logs.
  4. Check if the failure is related to this commit (0aeaaaf) 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/506/builds/12490

Failed tests:

  • test_pyrepl

Failed subtests:

  • test_repl_eio - test.test_pyrepl.test_unix_console.TestUnixConsoleEIOHandling.test_repl_eio

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

==

Click to see traceback logs
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_pyrepl/test_unix_console.py", line 390, in test_repl_eio
_, err = proc.communicate(timeout=support.LONG_TIMEOUT)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py", line 1273, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py", line 2293, in _communicate
self._check_timeout(endtime, orig_timeout, stdout, stderr)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py", line 1320, in _check_timeout
raise TimeoutExpired(
...<2 lines>...
stderr=b''.join(stderr_seq) if stderr_seq else None)
subprocess.TimeoutExpired: Command '['/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/python', '-E', '-S', '/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_pyrepl/eio_test_script.py']' timed out after 300.0 seconds
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py", line 1191, in __del__
_warn("subprocess %s is still running" % self.pid,
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning, source=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: subprocess 252083 is still running
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name=10 mode='rb' closefd=True>:
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/case.py", line 666, in run
with outcome.testPartExecutor(self):
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.TextIOWrapper name=10 encoding='utf-8'>
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name=8 mode='rb' closefd=True>:
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/case.py", line 666, in run
with outcome.testPartExecutor(self):
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.TextIOWrapper name=8 encoding='utf-8'>
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/subprocess.py", line 1191, in __del__
_warn("subprocess %s is still running" % self.pid,
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning, source=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: subprocess 289757 is still running
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name=10 mode='rb' closefd=True>:
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/case.py", line 666, in run
with outcome.testPartExecutor(self):
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.TextIOWrapper name=10 encoding='utf-8'>
Warning -- Unraisable exception
Exception ignored while finalizing file <_io.FileIO name=8 mode='rb' closefd=True>:
Traceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/unittest/case.py", line 666, in run
with outcome.testPartExecutor(self):
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
ResourceWarning: unclosed file <_io.TextIOWrapper name=8 encoding='utf-8'>

kumaraditya303 pushed a commit that referenced this pull request Mar 8, 2026
…H-145543) (#145621)
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543)
(cherry picked from commit 0aeaaaf)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
kumaraditya303 pushed a commit that referenced this pull request Mar 8, 2026
…H-145543) (#145622)
gh-145376: Fix refleak in `queuemodule.c` out-of-memory path (GH-145543)
(cherry picked from commit 0aeaaaf)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
@eendebakpt
eendebakpt deleted the refleak_queuemodule branch March 19, 2026 21:39
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@eendebakpt@bedevere-bot@vstinner@kumaraditya303