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-113538: Don't crash in stream reader protocol callback when task is cancelled by gvanrossum · Pull Request #113690 · python/cpython

Conversation

@gvanrossum

@gvanrossum gvanrossum commented Jan 3, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

That callback exists purely to log an error when the coroutine running in the task raises an exception. But if the task was cancelled instead, the callback itself crashes, which just logs noise. In that case we should just close the transport without logging anything.

CC @jsundahl

  • Issue: Cannot cleanly shut down an asyncio based server #113538

Sorry, something went wrong.

Uh oh!

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

All reactions
@gvanrossum
Don't crash in stream reader protocol callback when task is cancelled
8eb5048
@gvanrossum gvanrossum added topic-asyncio needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jan 3, 2024
@gvanrossum
gvanrossum requested review from 1st1, asvetlov, kumaraditya303 and willingc as code owners January 3, 2024 22:15
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 3, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Jan 3, 2024
Cannot cleanly shut down an asyncio based server #113538
Closed
@gvanrossum
Blurb
f0a4893
@itamaro

itamaro commented Jan 4, 2024

Copy link
Copy Markdown
Contributor

is there a test case we can add that would cover the issue and fix?

gvanrossum and blueloveTH reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@gvanrossum
Add test
581df3a
jsundahl
jsundahl approved these changes Jan 4, 2024
View reviewed changes

@jsundahl jsundahl left a comment

Copy link
Copy Markdown

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.

looks good, I do think closing the transport if the task is cancelled is the correct thing to do.

Sorry, something went wrong.

Uh oh!

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

All reactions
itamaro
itamaro approved these changes Jan 4, 2024
View reviewed changes

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

thanks for adding a test case! LG!

Sorry, something went wrong.

Uh oh!

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

All reactions
kumaraditya303
kumaraditya303 approved these changes Jan 4, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jan 4, 2024
@gvanrossum
gvanrossum merged commit 4681a52 into python:main Jan 4, 2024
@miss-islington-app

miss-islington-app Bot commented Jan 4, 2024

Copy link
Copy Markdown

Thanks @gvanrossum for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

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 merge label Jan 4, 2024
@gvanrossum
gvanrossum deleted the asyncio-streams-fix branch January 4, 2024 20:20
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 4, 2024
@gvanrossum @miss-islington
pythongh-113538: Don't error in stream reader protocol callback when …
d492487
…task is cancelled (pythonGH-113690)

(cherry picked from commit 4681a52)

Co-authored-by: Guido van Rossum <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 4, 2024
@gvanrossum @miss-islington
pythongh-113538: Don't error in stream reader protocol callback when …
6429b46
…task is cancelled (pythonGH-113690)

(cherry picked from commit 4681a52)

Co-authored-by: Guido van Rossum <[email protected]>
@bedevere-app

bedevere-app Bot commented Jan 4, 2024

Copy link
Copy Markdown

GH-113713 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 Jan 4, 2024
@bedevere-app

bedevere-app Bot commented Jan 4, 2024

Copy link
Copy Markdown

GH-113714 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 Jan 4, 2024
gvanrossum added a commit that referenced this pull request Jan 4, 2024
@miss-islington @gvanrossum
[3.11] gh-113538: Don't error in stream reader protocol callback when…
456e2ec
… task is cancelled (GH-113690) (#113714)

(cherry picked from commit 4681a52)

Co-authored-by: Guido van Rossum <[email protected]>
gvanrossum added a commit that referenced this pull request Jan 4, 2024
@miss-islington @gvanrossum
[3.12] gh-113538: Don't error in stream reader protocol callback when…
92ba4e1
… task is cancelled (GH-113690) (#113713)

(cherry picked from commit 4681a52)

Co-authored-by: Guido van Rossum <[email protected]>
@mhils mhils mentioned this pull request Jan 21, 2024
Constant exceptions in callback StreamReaderProtocol.connection_made... at asyncio.streams.py when using transparent mode mitmproxy/mitmproxy#6600
Closed
kulikjak pushed a commit to kulikjak/cpython that referenced this pull request Jan 22, 2024
@gvanrossum @kulikjak
pythongh-113538: Don't error in stream reader protocol callback when …
805e16a
…task is cancelled (python#113690)
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@gvanrossum @aisk
pythongh-113538: Don't error in stream reader protocol callback when …
8c17f66
…task is cancelled (python#113690)
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@gvanrossum @Glyphack
pythongh-113538: Don't error in stream reader protocol callback when …
b063464
…task is cancelled (python#113690)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@itamaro itamaro itamaro approved these changes
@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner
+1 more reviewer
@jsundahl jsundahl jsundahl approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

topic-asyncio

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

4 participants

@gvanrossum @itamaro @jsundahl @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.