gh-86802: Fix asyncio memory leak; shielded tasks where cancelled log…#134331
gh-86802: Fix asyncio memory leak; shielded tasks where cancelled log…#134331ambv merged 4 commits intopython:mainfrom
Conversation
…ed log once through the exception handler
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
|
||
| def _outer_done_callback(outer): | ||
| if not inner.done(): | ||
| inner.remove_done_callback(_inner_done_callback) |
There was a problem hiding this comment.
Before this PR, this line made the future_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.
Now we're only adding the callback to future_discard_from_awaited_by when there is a current task. Nice.
|
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 commit f695eca) 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 the 3.14 branch. |
|
@ambv you are indeed a provider |
…ions log once through the exception handler (pythongh-134331)" This reverts commit f695eca.
…ions log once through the exception handler (pythongh-134331)" This reverts commit f695eca.
… once through the exception handler (pythongh-134331) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
… once through the exception handler (pythongh-134331) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
… once through the exception handler (pythongh-134331) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
… once through the exception handler