Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-86802: Fix asyncio memory leak; shielded tasks where cancelled log…#134331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…ed log once through the exception handler
python-cla-botbot commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Uh oh!
There was an error while loading.Please reload this page.
@@ -972,10 +983,16 @@ def _inner_done_callback(inner, cur_task=cur_task): | |||
else: | |||
outer.set_result(inner.result()) | |||
def _outer_done_callback(outer): | |||
if not inner.done(): | |||
inner.remove_done_callback(_inner_done_callback) |
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.
Before this PR, this line made thefuture_discard_from_awaited_by
never execute for cases when the outer shield was cancelled. That was a memory leak, which is now fixed.
if cur_task is not None: | ||
inner.add_done_callback(_clear_awaited_by_callback) |
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.
Now we're only adding the callback tofuture_discard_from_awaited_by
when thereis a current task. Nice.
f695eca
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@ChristianHrs for the PR, and@ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
… once through the exception handler (pythongh-134331)(cherry picked from commitf695eca)Co-authored-by: Christian Harries <68507104+ChristianHrs@users.noreply.github.com>Co-authored-by: Łukasz Langa <lukasz@langa.pl>
GH-134343 is a backport of this pull request to the3.14 branch. |
@ambv you are indeed a provider |
…ions log once through the exception handler (pythongh-134331)"This reverts commitf695eca.
…ions log once through the exception handler (pythongh-134331)"This reverts commitf695eca.
Uh oh!
There was an error while loading.Please reload this page.
… once through the exception handler