René's URL Explorer Experiment


Title: RemoteUnwinder.get_async_stack_trace() crashes with a C stack overflow on a deeply nested awaited_by graph instead of raising · Issue #151535 · python/cpython · GitHub

Open Graph Title: RemoteUnwinder.get_async_stack_trace() crashes with a C stack overflow on a deeply nested awaited_by graph instead of raising · Issue #151535 · python/cpython

X Title: RemoteUnwinder.get_async_stack_trace() crashes with a C stack overflow on a deeply nested awaited_by graph instead of raising · Issue #151535 · python/cpython

Description: Bug description _remote_debugging.RemoteUnwinder.get_async_stack_trace() reconstructs the async call graph of a target process by recursing up the awaited_by relation. The recursion is a three-function cycle with no depth limit, cycle de...

Open Graph Description: Bug description _remote_debugging.RemoteUnwinder.get_async_stack_trace() reconstructs the async call graph of a target process by recursing up the awaited_by relation. The recursion is a three-func...

X Description: Bug description _remote_debugging.RemoteUnwinder.get_async_stack_trace() reconstructs the async call graph of a target process by recursing up the awaited_by relation. The recursion is a three-func...

Opengraph URL: https://github.com/python/cpython/issues/151535

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RemoteUnwinder.get_async_stack_trace() crashes with a C stack overflow on a deeply nested awaited_by graph instead of raising","articleBody":"## Bug description\n\n`_remote_debugging.RemoteUnwinder.get_async_stack_trace()` reconstructs the async\ncall graph of a target process by recursing **up** the `awaited_by` relation. The\nrecursion is a three-function cycle with no depth limit, cycle detection, or\n`_Py_EnterRecursiveCall` guard:\n\n`process_task_and_waiters` → `process_task_awaited_by` → `process_waiter_task` →\n`process_task_and_waiters` (…)\n\n(On main these are in `Modules/_remote_debugging/asyncio.c`; on 3.14 they are in\nthe single-file `Modules/_remote_debugging_module.c`.) Each level also stack-allocates\na `char task_obj[SIZEOF_TASK_OBJ]` (`SIZEOF_TASK_OBJ == 4096`), so ~1900 levels\nexhaust a default 8 MiB stack. When the target's running task sits at the bottom of\na sufficiently deep `awaited_by` chain, the **debugger process** (the one calling\n`get_async_stack_trace()`) overflows its C stack and dies with SIGSEGV.\n\nThis is asymmetric with the iterative sibling path: `get_all_awaited_by` /\n`append_awaited_by_for_thread` bounds its walk with `MAX_ITERATIONS = 2 \u003c\u003c 15`.\nOnly the recursive `get_async_stack_trace` path is unbounded. The module already\ntreats the target's tables as untrusted input (`debug_offsets_validation.h`) and the\nthread-list walk already has explicit \"corrupted remote memory\" cycle detection, so\nbounding this traversal is consistent with the module's existing invariants.\n\nThe same pattern (C recursion converted to `RecursionError` instead of a segfault)\nwas treated as a bug in https://github.com/python/cpython/issues/137894.\n\n### Reproducer\n\nA target with a deep linear `awaited_by` chain whose leaf is the running task; a\nsecond process attaches and calls `get_async_stack_trace()`:\n\n```python\n# target.py \u003cN>:  tN await t(N-1) await ... await leaf;  leaf busy-spins (= running task)\n# attacker.py \u003cpid>:\nfrom _remote_debugging import RemoteUnwinder\nRemoteUnwinder(int(pid)).get_async_stack_trace()\n```\n\n- `N = 10`   → returns a stack trace cleanly (exit 0).\n- `N >= ~2000` → attacker process **SIGSEGV** (exit 139). gdb shows ~1884 stacked\n  `process_task_awaited_by` frames terminating at a guard-page fault.\n\n(Full PoC scripts available on request.)\n\n### Reproduced on\n\n- CPython **3.14.6** (GA, `python:3.14` image, aarch64 Linux) — crashes.\n- CPython 3.16 `main` (local `--with-pydebug` build) — same unguarded recursion in source.\n\nCross-process attach uses the normal Linux ptrace/`process_vm_readv` path\n(`--cap-add=SYS_PTRACE`); the crash is in the **debugger**, driven by the target's\ngraph shape. A privileged profiler/observability tool attaching to an untrusted (or\njust legitimately deeply nested) workload is the realistic setting.\n\n### Expected behavior\n\nA bounded traversal — raise/propagate an error (as the iterative path does on hitting\nits limit), not crash the debugger process.\n\n## Proposed fix\n\nBound the `process_task_and_waiters` ↔ `process_waiter_task` recursion, matching the\niterative sibling. I have a PR ready that adds an explicit recursion-depth cap\n(`MAX_TASK_AWAITED_BY_DEPTH`, mirroring the existing `MAX_ITERATIONS` /\n`MAX_SET_TABLE_SIZE` constants in the module) and raises a `RuntimeError` on\noverflow, which also handles a cyclic `awaited_by` graph from corrupted remote\nmemory. Happy to open it.\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-151536\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/tonghuaroot","@type":"Person","name":"tonghuaroot"},"datePublished":"2026-06-16T08:48:12Z","url":"https://github.com/python/cpython/issues/151535"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:32ef83f3-e8e3-42dc-b323-d7fbb9795a8e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA74A:2F543F:1B94402:246C845:6B02201C
html-safe-nonce44046e36a937d8a844da29ae9c8797611076cbd9fc56b6e389094ccceaaee939
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzRBOjJGNTQzRjoxQjk0NDAyOjI0NkM4NDU6NkIwMjIwMUMiLCJ2aXNpdG9yX2lkIjoiMTY1NzQ5MDAwMjcwNjUxNDIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7bb9e5225f96f07b1198effa96b9e6b0b89252ba137e2df32ba1a7f37a8f036b
hovercard-subject-tagissue:4672582416
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/151535/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b6502fc5385611eb47ba179af3f3685661fee8d1c7f984c426c3e3a21753b451/python/cpython/issues/151535
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b6502fc5385611eb47ba179af3f3685661fee8d1c7f984c426c3e3a21753b451/python/cpython/issues/151535
og:image:altBug description _remote_debugging.RemoteUnwinder.get_async_stack_trace() reconstructs the async call graph of a target process by recursing up the awaited_by relation. The recursion is a three-func...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametonghuaroot
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/151535#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151535
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151535
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/151535
Reloadhttps://github.com/python/cpython/issues/151535
Reloadhttps://github.com/python/cpython/issues/151535
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/151535
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/151535
RemoteUnwinder.get_async_stack_trace() crashes with a C stack overflow on a deeply nested awaited_by graph instead of raisinghttps://github.com/python/cpython/issues/151535#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/tonghuaroot
tonghuaroothttps://github.com/tonghuaroot
on Jun 16, 2026https://github.com/python/cpython/issues/151535#issue-4672582416
#137894https://github.com/python/cpython/issues/137894
gh-151535: Bound _remote_debugging asyncio awaited_by graph recursion #151536https://github.com/python/cpython/pull/151536
tonghuaroothttps://github.com/tonghuaroot
on Jun 16, 2026https://github.com/python/cpython/issues/151535#event-26802078304
pythongh-151535: Walk awaited_by graph iteratively to avoid C stack o…https://github.com/tonghuaroot/cpython/commit/dcd1db0c5d6e68257328faf04dca19d49913c454
pythongh-151535https://github.com/python/cpython/issues/151535
dcd1db0https://github.com/tonghuaroot/cpython/commit/dcd1db0c5d6e68257328faf04dca19d49913c454
picnixzhttps://github.com/picnixz
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
on Jun 16, 2026https://github.com/python/cpython/issues/151535#event-26829797492
serhiy-storchakahttps://github.com/serhiy-storchaka
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
on Jul 3, 2026https://github.com/python/cpython/issues/151535#event-27545879697
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Jul 3, 2026https://github.com/python/cpython/issues/151535#event-27545880656
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Jul 3, 2026https://github.com/python/cpython/issues/151535
kumaraditya303https://github.com/kumaraditya303
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
topic-asynciohttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-asyncio%22
on Jul 11, 2026https://github.com/python/cpython/issues/151535#event-27852056277
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/151535#event-33592116699
github-project-automationhttps://github.com/apps/github-project-automation
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/151535
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/151535#event-33592172658
kumaraditya303https://github.com/kumaraditya303
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 21, 2026https://github.com/python/cpython/issues/151535#event-33828185891
github-project-automationhttps://github.com/apps/github-project-automation
asynciohttps://github.com/orgs/python/projects/29
on Oct 21, 2026https://github.com/python/cpython/issues/151535
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/151535
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/151535
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
asynciohttps://github.com/orgs/python/projects/29
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.