gh-153364: Add frame limit in get_async_stack_trace() and parse_coro_chain()#153365
Open
maurycy wants to merge 8 commits into
Open
gh-153364: Add frame limit in get_async_stack_trace() and parse_coro_chain()#153365maurycy wants to merge 8 commits into
get_async_stack_trace() and parse_coro_chain()#153365maurycy wants to merge 8 commits into
Conversation
maurycy
commented
Jul 8, 2026
| @@ -325,10 +327,19 @@ int | |||
| parse_coro_chain( | |||
Contributor
Author
There was a problem hiding this comment.
Does it actually need to be recursive?
To put aside recursive v. iterative; CS101 strikes: if you ask me, I was thinking about a visited set here... not applicable to this fix but cycle detected would be such a nice touch. :-)
Contributor
Author
There was a problem hiding this comment.
maurycy
commented
Jul 8, 2026
| #define MAX_STACK_CHUNK_SIZE (16 * 1024 * 1024) /* 16 MB max for stack chunks */ | ||
| #define MAX_LONG_DIGITS 64 /* Allows values up to ~2^1920 */ | ||
| #define MAX_SET_TABLE_SIZE (1 << 20) /* 1 million entries max for set iteration */ | ||
| #define MAX_FRAME_CHAIN_DEPTH (1024 + 512) /* Iteration bound for frame chain walks */ |
Contributor
Author
There was a problem hiding this comment.
Not the scope but maybe MAX_THREADS, MAX_STACK_CHUNKS, MAX_LINETABLE_ENTRIES or MAX_ITERATIONS are worth keeping here too
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.
Fixes #153364
The PR hardens and cleans up max frame chain limits a bit.
It introduces a const (
MAX_FRAME_CHAIN_DEPTH), uses it in the existingprocess_frame_chain(), which is called byget_stack_trace(), as well as adds it toparse_coro_chain(), used in both sync and async pathways, and toparse_async_frame_chain().The obvious context here is avoiding infinite loops. Truth be told, I think that in some places it unexpectedly works (ie: doesn't hang) because incomplete / torn-reads result in an exception. :-)
_remote_debugging: No frame limit inget_async_stack_trace()#153364