Title: profiling.sampling crash when using --async-aware mode with --binary or --gecko · Issue #152434 · python/cpython · GitHub
Open Graph Title: profiling.sampling crash when using --async-aware mode with --binary or --gecko · Issue #152434 · python/cpython
X Title: profiling.sampling crash when using --async-aware mode with --binary or --gecko · Issue #152434 · python/cpython
Description: Bug report Bug description: The Gecko and binary collectors don't currently handle AwaitedInfo and crash when used with --async-aware mode. For --binary we could flatten async samples into frame stacks, but replaying to a collector like ...
Open Graph Description: Bug report Bug description: The Gecko and binary collectors don't currently handle AwaitedInfo and crash when used with --async-aware mode. For --binary we could flatten async samples into frame st...
X Description: Bug report Bug description: The Gecko and binary collectors don't currently handle AwaitedInfo and crash when used with --async-aware mode. For --binary we could flatten async samples into fram...
Opengraph URL: https://github.com/python/cpython/issues/152434
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"profiling.sampling crash when using --async-aware mode with --binary or --gecko","articleBody":"# Bug report\n\n### Bug description:\n\nThe Gecko and binary collectors don't currently handle `AwaitedInfo` and crash when used with `--async-aware` mode.\n\nFor `--binary` we could flatten async samples into frame stacks, but replaying to a collector like `--live` (and potential future collectors which handle async natively) would lose async details. A better option could be to change to the binary format to store task information. \n\nFor `--gecko` we can just implement the same flattening logic like other collectors have.\n\nReproducer:\n\n`repro_async_issue.py`\n```python\nimport asyncio\n\nasync def w():\n s = 0\n for i in range(1_000_000):\n s += i\n await asyncio.sleep(0)\n return s\n\nasync def main():\n await asyncio.gather(w(), w())\n\nasyncio.run(main())\n\n```\n\n```bash\npython.exe -m profiling.sampling run --gecko --async-aware ./repro_async_issue.py\nTraceback (most recent call last):\n File \"/Users/lkollar/github/cpython/Lib/runpy.py\", line 201, in _run_module_as_main\n return _run_code(code, main_globals, None,\n \"__main__\", mod_spec)\n File \"/Users/lkollar/github/cpython/Lib/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n ~~~~^^^^^^^^^^^^^^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/__main__.py\", line 65, in \u003cmodule>\n main()\n ~~~~^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/cli.py\", line 977, in main\n _main()\n ~~~~~^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/cli.py\", line 1133, in _main\n handler(args)\n ~~~~~~~^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/cli.py\", line 1280, in _handle_run\n collector = sample(\n process.pid,\n ...\u003c9 lines>...\n blocking=args.blocking,\n )\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 525, in sample\n profiler.sample(collector, duration_sec, async_aware=async_aware)\n ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 188, in sample\n raise e from None\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 169, in sample\n flush_pending()\n ~~~~~~~~~~~~~^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 148, in flush_pending\n collector.collect(prev_stack, timestamps_us=ts)\n ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/gecko_collector.py\", line 255, in collect\n for thread_info in interpreter_info.threads:\n ^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: '_remote_debugging.AwaitedInfo' object has no attribute 'threads'. Did you mean '.thread_id' instead of '.threads'?\n```\n\n```bash\nTraceback (most recent call last):\n File \"/Users/lkollar/github/cpython/Lib/runpy.py\", line 201, in _run_module_as_main\n return _run_code(code, main_globals, None,\n \"__main__\", mod_spec)\n File \"/Users/lkollar/github/cpython/Lib/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n ~~~~^^^^^^^^^^^^^^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/__main__.py\", line 65, in \u003cmodule>\n main()\n ~~~~^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/cli.py\", line 977, in main\n _main()\n ~~~~~^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/cli.py\", line 1133, in _main\n handler(args)\n ~~~~~~~^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/cli.py\", line 1280, in _handle_run\n collector = sample(\n process.pid,\n ...\u003c9 lines>...\n blocking=args.blocking,\n )\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 525, in sample\n profiler.sample(collector, duration_sec, async_aware=async_aware)\n ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 188, in sample\n raise e from None\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/sample.py\", line 176, in sample\n collector.collect(stack_frames)\n ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^\n File \"/Users/lkollar/github/cpython/Lib/profiling/sampling/binary_collector.py\", line 84, in collect\n self._writer.write_sample(stack_frames, timestamp_us)\n ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: 'str' object cannot be interpreted as an integer\n```\n\nCC: @pablogsal \n\n### CPython versions tested on:\n\n3.16\n\n### Operating systems tested on:\n\nLinux, macOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-152442\n* gh-152444\n* gh-152446\n* gh-152450\n* gh-152496\n* gh-152498\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/lkollar","@type":"Person","name":"lkollar"},"datePublished":"2026-06-27T15:56:21Z","url":"https://github.com/python/cpython/issues/152434"}
| 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:ccf53ecf-efe6-dfa9-7c30-34a50c0621b5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D9F0:46358:416609:558650:6B023B27 |
| html-safe-nonce | 50fd1e4ee8a6b3226aa129207bc329a43fd0472d24fedbee617bd69974c69bea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOUYwOjQ2MzU4OjQxNjYwOTo1NTg2NTA6NkIwMjNCMjciLCJ2aXNpdG9yX2lkIjoiOTYwMTY2MjU2MDgwNzMwOTE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9be7a93d43d3e757360a6a2953b012814a24b3dd2a1d3edf29a416e60feb63f7 |
| hovercard-subject-tag | issue:4758978742 |
| 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/152434/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf859c61580708d4e7b5e831242fd57bfeed68951d4044bdf06e6500cfbf39d7/python/cpython/issues/152434 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf859c61580708d4e7b5e831242fd57bfeed68951d4044bdf06e6500cfbf39d7/python/cpython/issues/152434 |
| og:image:alt | Bug report Bug description: The Gecko and binary collectors don't currently handle AwaitedInfo and crash when used with --async-aware mode. For --binary we could flatten async samples into frame st... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lkollar |
| 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