Title: `profiling.sampling --async-aware` misses main interpreter tasks when subinterpreters exist · Issue #158968 · python/cpython · GitHub
Open Graph Title: `profiling.sampling --async-aware` misses main interpreter tasks when subinterpreters exist · Issue #158968 · python/cpython
X Title: `profiling.sampling --async-aware` misses main interpreter tasks when subinterpreters exist · Issue #158968 · python/cpython
Description: Bug report profiling.sampling --async-aware shows tasks from only one interpreter, so the main interpreter's tasks disappear once a subinterpreter exists Repro: import asyncio, os, time from concurrent.futures import InterpreterPoolExecu...
Open Graph Description: Bug report profiling.sampling --async-aware shows tasks from only one interpreter, so the main interpreter's tasks disappear once a subinterpreter exists Repro: import asyncio, os, time from concur...
X Description: Bug report profiling.sampling --async-aware shows tasks from only one interpreter, so the main interpreter's tasks disappear once a subinterpreter exists Repro: import asyncio, os, time from co...
Opengraph URL: https://github.com/python/cpython/issues/158968
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`profiling.sampling --async-aware` misses main interpreter tasks when subinterpreters exist","articleBody":"### Bug report\n\n`profiling.sampling --async-aware` shows tasks from only one interpreter, so the main interpreter's tasks disappear once a subinterpreter exists\n\nRepro:\n\n```python\nimport asyncio, os, time\nfrom concurrent.futures import InterpreterPoolExecutor\n\ndef blocking_work():\n import asyncio, time\n\n async def sub_spin():\n deadline = time.monotonic() + 60\n while time.monotonic() \u003c deadline:\n pass\n\n asyncio.run(sub_spin())\n\nasync def main():\n loop = asyncio.get_running_loop()\n with InterpreterPoolExecutor() as pool:\n loop.run_in_executor(pool, blocking_work)\n print(os.getpid(), flush=True)\n deadline = time.monotonic() + 60\n while time.monotonic() \u003c deadline:\n pass\n\nasyncio.run(main())\n```\n\nRun:\n\n```\nsudo ./python.exe -m profiling.sampling dump --async-aware --async-mode running \u003cPID>\n```\n\nActual output:\n\n```\nStack dump for PID 72163, thread 24398118 (task 4404221168; most recent call last):\n File \"\u003ctask>\", in Task-1\n File \"repro.py\", line 9, in blocking_work.\u003clocals>.sub_spin\n while time.monotonic() \u003c deadline:\n```\n\nExpected:\n\n```\nStack dump for PID 72163, thread 24398118 (task 4404221168; most recent call last):\n File \"\u003ctask>\", in Task-1\n File \"repro.py\", line 9, in blocking_work.\u003clocals>.sub_spin\n while time.monotonic() \u003c deadline:\n\nStack dump, thread 24398104 (task 4379889488; most recent call last):\n File \"\u003ctask>\", in Task-1\n File \"repro.py\", line 20, in main\n while time.monotonic() \u003c deadline:\n```\n\nProposed fix: add subinterpreter traversal like https://github.com/python/cpython/pull/158900 do\n\nI'll work on the fix\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-158971\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/deadlovelll","@type":"Person","name":"deadlovelll"},"datePublished":"2026-10-07T13:55:54Z","url":"https://github.com/python/cpython/issues/158968"}
| 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:13bdc98f-b053-e2b9-5ba1-3698f7fcfcd4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B73C:88BC0:1DC3C1:24FDB1:6B02333F |
| html-safe-nonce | 64996509e5a6cf4f7d2f49e0b1e1fb933963b2fa6a8a5c95a75a18f853a10178 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzNDOjg4QkMwOjFEQzNDMToyNEZEQjE6NkIwMjMzM0YiLCJ2aXNpdG9yX2lkIjoiNTcyNTc5OTc4NTE4NTgxNzQwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ebb16885c707bb5b49c26e448f78bb30b451bce34714b4f282988556b2545937 |
| hovercard-subject-tag | issue:5746210760 |
| 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/158968/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ade7532e5c8aca74c4e4c44f56e6458b77a46668d410ba69b8004a581b129e9c/python/cpython/issues/158968 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ade7532e5c8aca74c4e4c44f56e6458b77a46668d410ba69b8004a581b129e9c/python/cpython/issues/158968 |
| og:image:alt | Bug report profiling.sampling --async-aware shows tasks from only one interpreter, so the main interpreter's tasks disappear once a subinterpreter exists Repro: import asyncio, os, time from concur... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | deadlovelll |
| 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 | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width