Repository navigation
gh-163217: Fix await cycle reporting in async-aware stack dumps - #163219
Open
deadlovelll wants to merge 3 commits into
Open
deadlovelll wants to merge 3 commits into
deadlovelll wants to merge 3 commits into
Conversation
deadlovelll
requested review from
1st1,
asvetlov,
kumaraditya303,
pablogsal and
willingc
as code owners
December 5, 2026 22:09
maurycy
reviewed
Dec 6, 2026
| for awaited_info in result | ||
| for task in awaited_info.awaited_by | ||
| } | ||
| raise CycleFoundException(cycles, id2name) |
Contributor
There was a problem hiding this comment.
An await cycle can be a valid state for the target. The example from the issue is valid (asyncio.wait() with timeout so it resolves on its own). I'm not sure if dump should refuse to print (it's similar to asyncio ps).
Could iter_async_frames() start from the leaves as it does now, then pick one task from each cycle it missed? There's already visited in _build_linear_stacks(). That'd cover dump and the collectors.
Contributor
Author
There was a problem hiding this comment.
thnx! i have taken the comments into account and hope i have made the corrections correctly
Contributor
Author
|
found interesting edge case: if we have awaiter of the cycle profiler splits the stack into two parts: import asyncio
import os
async def main():
async def a():
await task_b
async def b():
await asyncio.wait([task_a], timeout=60)
asyncio.current_task().set_name("X")
task_b = asyncio.create_task(b(), name="B")
task_a = asyncio.create_task(a(), name="A")
print(os.getpid(), flush=True)
await task_a
asyncio.run(main())Just fixed it with last commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix await cycle reporting in async-aware stack dumps
See gh-163217