Title: profiling: flamegraph export fails with RecursionError on a deeply recursive program · Issue #156545 · python/cpython · GitHub
Open Graph Title: profiling: flamegraph export fails with RecursionError on a deeply recursive program · Issue #156545 · python/cpython
X Title: profiling: flamegraph export fails with RecursionError on a deeply recursive program · Issue #156545 · python/cpython
Description: Bug report Bug description: The sampling profiler's flamegraph export (profiling.sampling.stack_collector.FlamegraphCollector.export) builds the flamegraph tree with a recursive walk (convert_children) and then serializes it with json.du...
Open Graph Description: Bug report Bug description: The sampling profiler's flamegraph export (profiling.sampling.stack_collector.FlamegraphCollector.export) builds the flamegraph tree with a recursive walk (convert_child...
X Description: Bug report Bug description: The sampling profiler's flamegraph export (profiling.sampling.stack_collector.FlamegraphCollector.export) builds the flamegraph tree with a recursive walk (convert_c...
Opengraph URL: https://github.com/python/cpython/issues/156545
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"profiling: flamegraph export fails with RecursionError on a deeply recursive program","articleBody":"# Bug report\n\n### Bug description:\n\nThe sampling profiler's flamegraph export (`profiling.sampling.stack_collector.FlamegraphCollector.export`) builds the flamegraph tree with a recursive walk (`convert_children`) and then serializes it with `json.dumps` — both recurse to the depth of the deepest sampled stack. The remote unwinder captures up to `MAX_FRAMES` (1536) frames, but export runs at the default recursion limit (1000), so profiling a program that recurses deeper than ~1000 makes `export()` raise `RecursionError` and write no flamegraph. Both `--flamegraph` and `--diff-flamegraph` are affected (the diff collector inherits `export`).\n\nReachable when profiling a program that raised its own recursion limit and recurses deeply (recursive-descent parsers, tree/graph walkers, deep serializers).\n\n### CPython versions tested on:\n\nCPython main\n\n### Operating systems tested on:\n\nLinux, macOS\n\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-156546\n* gh-158851\n* gh-158874\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/tonghuaroot","@type":"Person","name":"tonghuaroot"},"datePublished":"2026-08-29T03:37:04Z","url":"https://github.com/python/cpython/issues/156545"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a445b137-e5e6-9e4b-b828-64dfb523dc36 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1B0:323204:1AA9EC6:23204CF:6B021B64 |
| html-safe-nonce | 25ddcd9ce721cba7d4399b40569054fc609d31c50a1a92a4f20b80e95c22fe30 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUIwOjMyMzIwNDoxQUE5RUM2OjIzMjA0Q0Y6NkIwMjFCNjQiLCJ2aXNpdG9yX2lkIjoiODM1MTEzNzc3MDgwMjEyNTY2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 09a2596207c6a094c2db735ff5413ee92d84932b2e4843dc788984307f0a38ba |
| hovercard-subject-tag | issue:5284330428 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/156545/issue_layout |
| twitter:image | https://opengraph.githubassets.com/56b489194f5fdb439fd097aa7f666ac0bfe73ae3c66dbe9bfd14c5095a072138/python/cpython/issues/156545 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/56b489194f5fdb439fd097aa7f666ac0bfe73ae3c66dbe9bfd14c5095a072138/python/cpython/issues/156545 |
| og:image:alt | Bug report Bug description: The sampling profiler's flamegraph export (profiling.sampling.stack_collector.FlamegraphCollector.export) builds the flamegraph tree with a recursive walk (convert_child... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tonghuaroot |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width