GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-160499: Pause asyncio TLS reads when SSL replies pile up by gpshead · Pull Request #160500 · python/cpython

Conversation

@gpshead

@gpshead gpshead commented Oct 23, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

SSLProtocol read flow control only looked at the incoming BIO, so records OpenSSL writes on its own while processing a non-reading peer's input (TLS 1.2 renegotiation alerts, TLS 1.3 KeyUpdate replies) accumulated in the outgoing BIO without any bound. This counts that non-application output toward the read high-water mark and re-checks it from resume_writing(), so the transport stops reading from a peer that does not take the replies it solicits and resumes once it does. Application output is deliberately left out of the sum so that two peers which both write before they read cannot deadlock. The bound is coarse because the check runs after a whole transport read has been processed, so a single ~256 KiB read can still leave about 5.6 MB in the outgoing BIO before reads pause; resume_writing() now re-checks reading in every state rather than only from _do_read().

Fixes #160499

ANT-2026-RNWRQ22W

  • Issue: asyncio TLS server memory grows without bound for a peer that stops reading #160499

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gpshead
pythongh-160499: Pause asyncio TLS reads when SSL replies pile up
8f1b557
SSLProtocol read flow control only looked at the incoming BIO, so records
OpenSSL writes on its own while reading a non-reading peer (renegotiation
alerts, KeyUpdate replies) grew the outgoing BIO without bound.  Count that
non-application output toward the read high-water mark and re-check it when
writing resumes.

ANT-2026-RNWRQ22W
@gpshead gpshead added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 23, 2026
@gpshead gpshead self-assigned this Oct 23, 2026
@gpshead gpshead added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 23, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 23, 2026
asyncio TLS server memory grows without bound for a peer that stops reading #160499
Closed
@gpshead gpshead added the type-security A security issue label Oct 23, 2026
@gpshead
Clarify what _outgoing_app_size counts in sslproto comments
e070e9c
@gpshead gpshead added the sprint label Oct 23, 2026
@github-project-automation github-project-automation Bot added this to Sprint Oct 23, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 23, 2026
@gpshead
gpshead marked this pull request as ready for review October 23, 2026 21:34
@gpshead
gpshead requested a review from picnixz as a code owner October 23, 2026 21:34
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 23, 2026
@gpshead gpshead moved this from Todo to In Progress in Sprint Oct 25, 2026
@gpshead
gpshead requested a review from kumaraditya303 October 25, 2026 23:40
asvetlov
asvetlov approved these changes Oct 29, 2026
View reviewed changes

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good catch!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Oct 29, 2026
kumaraditya303
kumaraditya303 approved these changes Oct 29, 2026
View reviewed changes
@kumaraditya303
kumaraditya303 merged commit 8a5e24a into python:main Oct 29, 2026
61 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Oct 29, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Sprint Oct 29, 2026
@miss-islington-app

miss-islington-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

bedevere-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

GH-160893 is a backport of this pull request to the 3.15 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 29, 2026
@bedevere-app

bedevere-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 29, 2026
@bedevere-app

bedevere-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Oct 29, 2026
@bedevere-app

bedevere-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

GH-160896 is a backport of this pull request to the 3.12 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Oct 29, 2026
@bedevere-app

bedevere-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

GH-160897 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.11 only security fixes label Oct 29, 2026
kumaraditya303 pushed a commit that referenced this pull request Oct 29, 2026
@miss-islington @gpshead
[3.14] gh-160499: Pause asyncio TLS reads when SSL replies pile up (G…
719cdc0
…H-160500) (#160894)

gh-160499: Pause asyncio TLS reads when SSL replies pile up (GH-160500)
(cherry picked from commit 8a5e24a)

Co-authored-by: Gregory P. Smith <[email protected]>
kumaraditya303 pushed a commit that referenced this pull request Oct 29, 2026
@miss-islington @gpshead
[3.15] gh-160499: Pause asyncio TLS reads when SSL replies pile up (G…
32b2550
…H-160500) (#160893)

gh-160499: Pause asyncio TLS reads when SSL replies pile up (GH-160500)
(cherry picked from commit 8a5e24a)

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

Reviewers

@asvetlov asvetlov asvetlov approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@picnixz picnixz Awaiting requested review from picnixz picnixz is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gpshead gpshead

Labels

sprint type-security A security issue

Projects

Sprint
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

asyncio TLS server memory grows without bound for a peer that stops reading

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@gpshead @asvetlov @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.