René's URL Explorer Experiment


Title: `_remote_debugging`: binary format only `total_samples:u32` · Issue #151292 · python/cpython · GitHub

Open Graph Title: `_remote_debugging`: binary format only `total_samples:u32` · Issue #151292 · python/cpython

X Title: `_remote_debugging`: binary format only `total_samples:u32` · Issue #151292 · python/cpython

Description: Bug report Bug description: The binary format defines total_samples as just u32: cpython/Modules/_remote_debugging/binary_io.h Line 269 in 540b3d0 uint32_t total_samples; cpython/Modules/_remote_debugging/binary_io.h Lines 53 to 54 in 54...

Open Graph Description: Bug report Bug description: The binary format defines total_samples as just u32: cpython/Modules/_remote_debugging/binary_io.h Line 269 in 540b3d0 uint32_t total_samples; cpython/Modules/_remote_de...

X Description: Bug report Bug description: The binary format defines total_samples as just u32: cpython/Modules/_remote_debugging/binary_io.h Line 269 in 540b3d0 uint32_t total_samples; cpython/Modules/_remote_de...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`_remote_debugging`: binary format only `total_samples:u32`","articleBody":"# Bug report\n\n### Bug description:\n\nThe binary format defines `total_samples` as just `u32`:\n\nhttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io.h#L269\n\nhttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io.h#L53-L54\n\nThat's not that much... With just 100khz:\n\n| Threads | overflow after... |\n|--------:|------------------:|\n| 1       | ~11.9 h           |\n| 4       | ~3.0 h            |\n| 10      | ~71 min           |\n| 64      | ~11 min           |\n\nespecially if we aim for continous profiling of real production systems. But even of macOS, I'm observing ~0.5-1MHz on my `mach_vm_remap` branch already...\n\nTo make matters worse, since #150349 it results in `OverflowError` and the binary file is just corrupted:\n\n```\n2026-06-11T02:03:53.357502000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (vmremap 0bdde7f?) % ls -l /tmp/overflow.bin\n-rw-r--r--@ 1 root  wheel  4894411257 Jun 11 01:45 /tmp/overflow.bin\n2026-06-11T02:03:58.920689000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (vmremap 0bdde7f?) % head -c 128 /tmp/overflow.bin | xxd\n00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................\n00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................\n00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................\n00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................\n00000040: 28b5 2ffd 0058 5c1d 013a d500 1621 8025  (./..X\\..:...!.%\n00000050: 49d2 0133 3003 331a 3330 3d32 35a9 ccc0  I..30.3.30=25...\n00000060: 3aa9 049c b5d6 b69d d296 3122 4488 0c6d  :.........1\"D..m\n00000070: 0148 0150 014f 0946 32bd b931 318c b6de  .H.P.O.F2..11...\n```\n\nas the header is written on finalize:\n\nhttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io_writer.c#L1074\nhttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io_writer.c#L1196-L1223\n\nTo put aside that `u32` is just too little, we should be graceful here.\n\nOther fields seem to be fine, but need a double check here. I think that rotating files is a stop gap, and we need [chunking](https://github.com/maurycy/cpython/pull/2).\n\n# Reproduction\n\n(as a part of routine stress tests of https://github.com/maurycy/cpython/pull/3)\n\n```bash\n[130] 2026-06-10T23:35:58.225891000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (vmremap 92ad857*?) % sudo ./python.exe -m profiling.sampling run --binary -r 1000khz -d 25000 -o /tmp/overflow.bin --realtime-stats busywork.py\nStats: 647,833.9Hz (1.5µs) Min: 615,379.9Hz Max: 705,712.7Hz N=4294631818 Cache: 100.0% (4294631818+0/1)Traceback (most recent call last):\n  File \"\u003cfrozen runpy>\", line 201, in _run_module_as_main\n  File \"\u003cfrozen runpy>\", line 87, in _run_code\n  File \"/Users/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/__main__.py\", line 65, in \u003cmodule>\n    main()\n    ~~~~^^\n  File \"/Users/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/cli.py\", line 977, in main\n    _main()\n    ~~~~~^^\n  File \"/Users/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/cli.py\", line 1133, in _main\n    handler(args)\n    ~~~~~~~^^^^^^\n  File \"/Users/maurycy/src/github.com/maurycy/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/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/sample.py\", line 504, in sample\n    profiler.sample(collector, duration_sec, async_aware=async_aware)\n    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/Users/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/sample.py\", line 167, in sample\n    raise e from None\n  File \"/Users/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/sample.py\", line 155, in sample\n    collector.collect(stack_frames)\n    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^\n  File \"/Users/maurycy/src/github.com/maurycy/cpython/Lib/profiling/sampling/binary_collector.py\", line 84, in collect\n    self._writer.write_sample(stack_frames, timestamp_us)\n    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nOverflowError: too many samples for binary format\n[1] 2026-06-11T01:47:42.249903000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (vmremap cd5a675*?) %\n```\n\n```python\ndef hot_a(n):\n    return sum(i * i for i in range(n))\n\n\ndef hot_b(n):\n    return sum(i + i for i in range(n))\n\n\ndef worker():\n    while True:\n        hot_a(6_000_000)\n        hot_b(6_000_000)\n\n\nworker()\n```\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-152892\n* gh-153425\n* gh-153436\n* gh-158830\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/maurycy","@type":"Person","name":"maurycy"},"datePublished":"2026-06-11T00:11:56Z","url":"https://github.com/python/cpython/issues/151292"}

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:e600a4f1-3d58-cc8b-82f3-1921af03d477
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEC78:EA09B:39F87A8:4CCBC76:6B021B8D
html-safe-nonce861d2e2fd532bb635bb5c3cf99539bec00f094aa35dc3689057fc947c075ae0e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzc4OkVBMDlCOjM5Rjg3QTg6NENDQkM3Njo2QjAyMUI4RCIsInZpc2l0b3JfaWQiOiIzNDExODYwMzk3NTQ2OTM3MjMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac2bd565d106852d5b99a685da13fdd531ee0224e92e36da393516ceeb77213b68
hovercard-subject-tagissue:4636019998
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/151292/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f24b1b6148d91c6c53460f55c04d16326c8acbe10b2ddb4e11c6d2de3feaad34/python/cpython/issues/151292
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f24b1b6148d91c6c53460f55c04d16326c8acbe10b2ddb4e11c6d2de3feaad34/python/cpython/issues/151292
og:image:altBug report Bug description: The binary format defines total_samples as just u32: cpython/Modules/_remote_debugging/binary_io.h Line 269 in 540b3d0 uint32_t total_samples; cpython/Modules/_remote_de...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemaurycy
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/151292#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F151292
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%2F151292
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/151292
Reloadhttps://github.com/python/cpython/issues/151292
Reloadhttps://github.com/python/cpython/issues/151292
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/151292
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/151292
_remote_debugging: binary format only total_samples:u32https://github.com/python/cpython/issues/151292#top
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%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/maurycy
maurycyhttps://github.com/maurycy
on Jun 11, 2026https://github.com/python/cpython/issues/151292#issue-4636019998
cpython/Modules/_remote_debugging/binary_io.hhttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io.h#L269
540b3d0https://github.com/python/cpython/commit/540b3d0a7fa7cd842f064f79b1410cbd6868bffa
cpython/Modules/_remote_debugging/binary_io.hhttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io.h#L53-L54
540b3d0https://github.com/python/cpython/commit/540b3d0a7fa7cd842f064f79b1410cbd6868bffa
#150349https://github.com/python/cpython/pull/150349
cpython/Modules/_remote_debugging/binary_io_writer.chttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io_writer.c#L1074
540b3d0https://github.com/python/cpython/commit/540b3d0a7fa7cd842f064f79b1410cbd6868bffa
cpython/Modules/_remote_debugging/binary_io_writer.chttps://github.com/python/cpython/blob/540b3d0a7fa7cd842f064f79b1410cbd6868bffa/Modules/_remote_debugging/binary_io_writer.c#L1196-L1223
540b3d0https://github.com/python/cpython/commit/540b3d0a7fa7cd842f064f79b1410cbd6868bffa
chunkinghttps://github.com/maurycy/cpython/pull/2
maurycy#3https://github.com/maurycy/cpython/pull/3
gh-151292: _remote_debugging: Do not corrupt the binary file when hitting OverflowError #152892https://github.com/python/cpython/pull/152892
gh-151292: Change total_samples:u32 in the binary format to total_samples:u64 #153425https://github.com/python/cpython/pull/153425
[3.15] gh-151292: Change total_samples:u32 in the binary format to total_samples:u64 (GH-153425) #153436https://github.com/python/cpython/pull/153436
[3.15] gh-151292: _remote_debugging: Do not corrupt the binary file when hitting OverflowError (GH-152892) #158830https://github.com/python/cpython/pull/158830
maurycyhttps://github.com/maurycy
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jun 11, 2026https://github.com/python/cpython/issues/151292#event-26601112678
https://github.com/maurycy
maurycyhttps://github.com/maurycy
on Jun 11, 2026https://github.com/python/cpython/issues/151292#issuecomment-4675905682
@pablogsalhttps://github.com/pablogsal
maurycyhttps://github.com/maurycy
on Jun 11, 2026https://github.com/python/cpython/issues/151292#event-26601119914
maurycyhttps://github.com/maurycy
on Jun 11, 2026https://github.com/python/cpython/issues/151292#event-26601123694
StanFromIrelandhttps://github.com/StanFromIreland
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-profilinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-profiling%22
on Jun 11, 2026https://github.com/python/cpython/issues/151292#event-26615862959
pablogsalhttps://github.com/pablogsal
on Jul 9, 2026https://github.com/python/cpython/issues/151292#event-27768450006
gh-151292: Change `total_samples:u32` in the binary format to `total_…https://github.com/python/cpython/commit/1d196507e6496aab072e741e03d3565142a681ae
gh-151292https://github.com/python/cpython/issues/151292
1d19650https://github.com/python/cpython/commit/1d196507e6496aab072e741e03d3565142a681ae
[3.15] gh-151292: Change `total_samples:u32` in the binary format to …https://github.com/python/cpython/commit/8ac2fcbee70a33b53fef88519714238f3b6782f7
gh-151292https://github.com/python/cpython/issues/151292
8ac2fcbhttps://github.com/python/cpython/commit/8ac2fcbee70a33b53fef88519714238f3b6782f7
pablogsalhttps://github.com/pablogsal
on Oct 5, 2026https://github.com/python/cpython/issues/151292#event-32467448831
pythongh-151292: Track binary writer finalization statehttps://github.com/maurycy/cpython/commit/9de4476a44758a2999d1defabba61e8b6866459c
pythongh-151292https://github.com/python/cpython/issues/151292
9de4476https://github.com/maurycy/cpython/commit/9de4476a44758a2999d1defabba61e8b6866459c
gh-151292: `_remote_debugging`: Do not corrupt the binary file when h…https://github.com/python/cpython/commit/f839c061d383bc87c3456d19bbdcbc1c30ed399b
gh-151292https://github.com/python/cpython/issues/151292
f839c06https://github.com/python/cpython/commit/f839c061d383bc87c3456d19bbdcbc1c30ed399b
[3.15] gh-151292: `_remote_debugging`: Do not corrupt the binary file…https://github.com/python/cpython/commit/8a7c23f316a6bdb3cc60c6920d465d2a81d3cf35
gh-151292https://github.com/python/cpython/issues/151292
8a7c23fhttps://github.com/python/cpython/commit/8a7c23f316a6bdb3cc60c6920d465d2a81d3cf35
Revert "[3.15] pythongh-151292: `_remote_debugging`: Do not corrupt t…https://github.com/pablogsal/cpython/commit/53776ad0079f7ef8357e3530fe32fb26750a01e3
pythongh-151292https://github.com/python/cpython/issues/151292
53776adhttps://github.com/pablogsal/cpython/commit/53776ad0079f7ef8357e3530fe32fb26750a01e3
[3.15] Restore deferred backports for 3.15.1, including GH-158874 (#1…https://github.com/python/cpython/commit/4ceb3faf2c1f5bf17c56be085c4b1c1b38e47f9e
GH-158874https://github.com/python/cpython/pull/158874
#1…https://github.com/python/cpython/pull/158882
4ceb3fahttps://github.com/python/cpython/commit/4ceb3faf2c1f5bf17c56be085c4b1c1b38e47f9e
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/151292#event-33592116559
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/151292
kevinprimeraquecreo-stackhttps://github.com/kevinprimeraquecreo-stack
Project_VKhttps://github.com/users/kevinprimeraquecreo-stack/projects/1
on Oct 18, 2026https://github.com/python/cpython/issues/151292#event-33592172462
hugovkhttps://github.com/hugovk
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 23, 2026https://github.com/python/cpython/issues/151292#event-34053621169
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/151292
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/151292
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%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
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.