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-152569: Fix asyncio.wait leaking tasks via await-graph on long-lived futures by Skn0tt · Pull Request #152585 · python/cpython

Conversation

@Skn0tt

@Skn0tt Skn0tt commented Jun 29, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

asyncio.wait registered the waiting task in each future's awaited_by set but only discarded it from completed futures, pinning the task on futures that never resolve. Discard from all futures on return.

Similar to fccbfc4.

  • Issue: asyncio.wait leaks completed tasks via the 3.14 await-graph when racing a long-lived Future (missing future_discard_from_awaited_by) #152569

Sorry, something went wrong.

Uh oh!

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

mxschmitt reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@Skn0tt
pythongh-152569: Fix asyncio.wait leaking tasks via await-graph on lo…
5f8ef37
…ng-lived futures

asyncio.wait registered the waiting task in each future's awaited_by set but only discarded it from completed futures, pinning the task on futures that never resolve. Discard from all futures on return.
@Skn0tt
Skn0tt requested review from 1st1, asvetlov, kumaraditya303 and willingc as code owners June 29, 2026 10:26
@python-cla-bot

python-cla-bot Bot commented Jun 29, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot mentioned this pull request Jun 29, 2026
asyncio.wait leaks completed tasks via the 3.14 await-graph when racing a long-lived Future (missing future_discard_from_awaited_by) #152569
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Jun 29, 2026
kumaraditya303
kumaraditya303 approved these changes Jun 30, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jun 30, 2026
@kumaraditya303
kumaraditya303 merged commit f8514dc into python:main Jul 2, 2026
57 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Jul 2, 2026
@kumaraditya303 kumaraditya303 added topic-asyncio 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 Jul 2, 2026
@miss-islington-app

miss-islington-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington-app

miss-islington-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@miss-islington-app

miss-islington-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

Thanks @Skn0tt for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app

bedevere-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

GH-152866 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 Jul 2, 2026
@bedevere-app

bedevere-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

GH-152867 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 Jul 2, 2026
@bedevere-app

bedevere-app Bot commented Jul 2, 2026

Copy link
Copy Markdown

GH-152868 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 Jul 2, 2026
@Skn0tt

Skn0tt commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the quick review!

All reactions

Sorry, something went wrong.

Uh oh!

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

@Skn0tt Skn0tt mentioned this pull request Jul 2, 2026
[Bug]: context.route retains completed Tasks until Connection close (memory leak) microsoft/playwright-python#3121
Closed
kumaraditya303 pushed a commit that referenced this pull request Jul 2, 2026
@miss-islington @Skn0tt
[3.14] gh-152569: Fix asyncio.wait leaking tasks via await-graph on l…
86e5a6e
…ong-lived futures (GH-152585) (#152866)

gh-152569: Fix asyncio.wait leaking tasks via await-graph on long-lived futures (GH-152585)
(cherry picked from commit f8514dc)

Co-authored-by: Simon Knott <[email protected]>
kumaraditya303 pushed a commit that referenced this pull request Jul 2, 2026
@miss-islington @Skn0tt
[3.15] gh-152569: Fix asyncio.wait leaking tasks via await-graph on l…
c2cb9bd
…ong-lived futures (GH-152585) (#152868)

gh-152569: Fix asyncio.wait leaking tasks via await-graph on long-lived futures (GH-152585)
(cherry picked from commit f8514dc)

Co-authored-by: Simon Knott <[email protected]>
@cemsbr cemsbr mentioned this pull request Jul 23, 2026
[Bug]: Sync API leaks one asyncio Task (plus its whole captured call stack) per API call on Python 3.14.0–3.14.6 microsoft/playwright-python#3148
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@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

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.

2 participants

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