Skip to content

Comments

gh-142516: fix reference leaks in ssl.SSLContext objects#143685

Merged
picnixz merged 6 commits intopython:mainfrom
picnixz:fix/ssl/leak-gc-142516
Feb 21, 2026
Merged

gh-142516: fix reference leaks in ssl.SSLContext objects#143685
picnixz merged 6 commits intopython:mainfrom
picnixz:fix/ssl/leak-gc-142516

Conversation

@picnixz
Copy link
Member

@picnixz picnixz commented Jan 11, 2026

I don't think it'll fix all the issues but at least it will fix some issues on SSL contexts.

@picnixz picnixz force-pushed the fix/ssl/leak-gc-142516 branch from b7fa115 to 6b08305 Compare January 11, 2026 12:17
@picnixz picnixz added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Jan 11, 2026
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @picnixz for commit 6b08305 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143685%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Jan 11, 2026
@picnixz picnixz changed the title gh-142516: fix reference leaks in ssl objects gh-142516: fix reference leaks in ssl.SSLContext objects Jan 11, 2026
@picnixz
Copy link
Member Author

picnixz commented Jan 18, 2026

When I am back home I will update the PR

@picnixz picnixz marked this pull request as draft February 7, 2026 11:07
@picnixz picnixz marked this pull request as ready for review February 7, 2026 11:08
@picnixz picnixz added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Feb 7, 2026
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @picnixz for commit 02226ce 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143685%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Feb 7, 2026
@picnixz picnixz added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes and removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Feb 7, 2026
@picnixz
Copy link
Member Author

picnixz commented Feb 7, 2026

Actually I will do the backports manually later. Too many conflicts.

@picnixz picnixz merged commit 3a2a686 into python:main Feb 21, 2026
72 checks passed
@picnixz picnixz deleted the fix/ssl/leak-gc-142516 branch February 21, 2026 11:31
picnixz added a commit to picnixz/cpython that referenced this pull request Feb 21, 2026
…ts (pythonGH-143685)

(cherry picked from commit 3a2a686)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Feb 21, 2026

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

Copy link
Member

@gpshead gpshead left a comment

Choose a reason for hiding this comment

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

thanks!

gpshead pushed a commit that referenced this pull request Feb 21, 2026
…-143685) (#145075)

* [3.14] gh-142516: fix reference leaks in `ssl.SSLContext` objects (GH-143685)
(cherry picked from commit 3a2a686)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* fix backport
@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 FreeBSD Refleaks 3.14 (tier-3) has failed when building commit 1decc7e.

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/1800/builds/1014) and take a look at the build logs.
  4. Check if the failure is related to this commit (1decc7e) 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/1800/builds/1014

Test leaking resources:

  • test_events: memory blocks

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.ware-freebsd.refleak/build/Lib/test/support/__init__.py", line 859, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('127.0.0.1', 59018), raddr=('127.0.0.1', 59019)>
Task was destroyed but it is pending!
task: <Task pending name='Task-2213' coro=<BaseSelectorEventLoop._accept_connection2() done, defined at /buildbot/buildarea/3.14.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py:217> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SelectorTransport.__del__ at 0x843ce44d0>:
Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py", line 873, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=9>
k


Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.ware-freebsd.refleak/build/Lib/test/support/__init__.py", line 859, in gc_collect
    gc.collect()
ResourceWarning: unclosed <socket.socket fd=9, family=2, type=1, proto=6, laddr=('127.0.0.1', 10128), raddr=('127.0.0.1', 10129)>
Task was destroyed but it is pending!
task: <Task pending name='Task-1257' coro=<BaseSelectorEventLoop._accept_connection2() done, defined at /buildbot/buildarea/3.14.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py:217> wait_for=<Future pending cb=[Task.task_wakeup()]>>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _SelectorTransport.__del__ at 0x842b784d0>:
Traceback (most recent call last):
  File "/buildbot/buildarea/3.14.ware-freebsd.refleak/build/Lib/asyncio/selector_events.py", line 873, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=9>
k

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