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-160520: Apply asyncio ssl_shutdown_timeout after peer EOF by gpshead · Pull Request #160521 · 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._on_shutdown_complete() cancelled the shutdown timer, or had none if the peer sent EOF before close(), and then called the non-aborting close() of the underlying transport, so a peer that half-closed and stopped reading kept the connection open with no time limit. The timer is now kept (or started) on the success path and cancelled by connection_lost() as before, so _check_shutdown_timeout() aborts the transport if its write buffer has not drained in time.

One behaviour change to be aware of: a peer that half-closes and then needs longer than ssl_shutdown_timeout to read the data still queued for it is now cut off with TimeoutError, as a peer that does not half-close already is.

Fixes #160520

ANT-2026-81HUBBJ7

  • Issue: asyncio SSL transport ignores ssl_shutdown_timeout after the peer sends EOF #160520

Sorry, something went wrong.

Uh oh!

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

All reactions
@gpshead gpshead added 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.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 SSL transport ignores ssl_shutdown_timeout after the peer sends EOF #160520
Closed
@gpshead
gpshead marked this pull request as ready for review October 23, 2026 22:03
@gpshead
gpshead requested a review from picnixz as a code owner October 23, 2026 22:03
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 23, 2026
@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 draft October 23, 2026 22:50
@bedevere-app bedevere-app Bot removed the awaiting core review label Oct 23, 2026
@gpshead

gpshead commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

leave as a draft while working out the windows testing issue

All reactions

Sorry, something went wrong.

Uh oh!

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

@gpshead
pythongh-160520: Apply asyncio ssl_shutdown_timeout after peer EOF
e5239db
Keep the SSL shutdown timer running until connection_lost(), and start
it when the peer shuts down first, so that a peer which sends EOF but
does not read cannot keep a closed transport open indefinitely.
@gpshead
gpshead force-pushed the scanfix-sslproto-81hubbj7 branch from 6d52b93 to e5239db Compare October 24, 2026 07:10
@gpshead
gpshead marked this pull request as ready for review October 25, 2026 05:51
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 25, 2026
@gpshead
gpshead merged commit ffe1315 into python:main Oct 25, 2026
55 checks passed

Uh oh!

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

@miss-islington-app

miss-islington-app Bot commented Oct 25, 2026

Copy link
Copy Markdown

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 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 removed the awaiting core review label Oct 25, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Oct 25, 2026
@bedevere-app

bedevere-app Bot commented Oct 25, 2026

Copy link
Copy Markdown

GH-160639 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 25, 2026
@bedevere-app

bedevere-app Bot commented Oct 25, 2026

Copy link
Copy Markdown

GH-160640 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 25, 2026
@gpshead
gpshead deleted the scanfix-sslproto-81hubbj7 branch October 25, 2026 05:56
gpshead added a commit that referenced this pull request Oct 25, 2026
@miss-islington @gpshead
[3.14] gh-160520: Apply asyncio ssl_shutdown_timeout after peer EOF (G…
ce48e3f
…H-160521) (#160640)

gh-160520: Apply asyncio ssl_shutdown_timeout after peer EOF (GH-160521)

Keep the SSL shutdown timer running until connection_lost(), and start
it when the peer shuts down first, so that a peer which sends EOF but
does not read cannot keep a closed transport open indefinitely.

ANT-2026-81HUBBJ7
(cherry picked from commit ffe1315)

Co-authored-by: Gregory P. Smith <[email protected]>
gpshead added a commit that referenced this pull request Oct 25, 2026
@miss-islington @gpshead
[3.15] gh-160520: Apply asyncio ssl_shutdown_timeout after peer EOF (G…
b354f56
…H-160521) (#160639)

gh-160520: Apply asyncio ssl_shutdown_timeout after peer EOF (GH-160521)

Keep the SSL shutdown timer running until connection_lost(), and start
it when the peer shuts down first, so that a peer which sends EOF but
does not read cannot keep a closed transport open indefinitely.

ANT-2026-81HUBBJ7
(cherry picked from commit ffe1315)

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

@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

Projects

Sprint
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

asyncio SSL transport ignores ssl_shutdown_timeout after the peer sends EOF

Uh oh!

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

1 participant

@gpshead
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.