René's URL Explorer Experiment


Title: `_remote_debugging`: returning the same samples over and over · Issue #149718 · python/cpython · GitHub

Open Graph Title: `_remote_debugging`: returning the same samples over and over · Issue #149718 · python/cpython

X Title: `_remote_debugging`: returning the same samples over and over · Issue #149718 · python/cpython

Description: Bug report Bug description: Diagnosis Note the consecutive identical here: 2026-05-12T10:27:01.788483000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main c6fd7de*?) % sudo ./python.exe -m profiling.sampling run -r 3...

Open Graph Description: Bug report Bug description: Diagnosis Note the consecutive identical here: 2026-05-12T10:27:01.788483000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main c6fd7de*?) % sudo ./p...

X Description: Bug report Bug description: Diagnosis Note the consecutive identical here: 2026-05-12T10:27:01.788483000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main c6fd7de*?) % sudo ./p...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`_remote_debugging`: returning the same samples over and over","articleBody":"# Bug report\n\n### Bug description:\n\n## Diagnosis\n\nNote the **consecutive identical** here:\n\n```bash\n2026-05-12T10:27:01.788483000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main c6fd7de*?) % sudo ./python.exe -m profiling.sampling run -r 300khz --pstats -o /dev/null -m test\n\n[...]\n\nCaptured 31,970,196 samples in 851.80 seconds\nSample rate: 37,532.68 samples/sec (consecutive identical: 30,295,039/31,457,858)\nError rate: 1.60\nWarning: missed 251961921 samples from the expected total of 283932117 (88.74%)\n```\n\nThat's with:\n\n```diff\ndiff --git i/Lib/profiling/sampling/sample.py w/Lib/profiling/sampling/sample.py\nindex 5bbe2483581..41c6dec4f6d 100644\n--- i/Lib/profiling/sampling/sample.py\n+++ w/Lib/profiling/sampling/sample.py\n@@ -109,6 +109,8 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):\n         last_sample_time = start_time\n         realtime_update_interval = 1.0  # Update every second\n         last_realtime_update = start_time\n+        prev_stack = None\n+        consecutive_identical = 0\n         try:\n             while duration_sec is None or running_time_sec \u003c duration_sec:\n                 # Check if live collector wants to stop\n@@ -125,6 +127,9 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):\n                         stack_frames = self._get_stack_trace(\n                             async_aware=async_aware\n                         )\n+                        if stack_frames == prev_stack:\n+                            consecutive_identical += 1\n+                        prev_stack = stack_frames\n                         collector.collect(stack_frames)\n                     except ProcessLookupError as e:\n                         running_time_sec = current_time - start_time\n@@ -178,7 +183,9 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):\n         if not is_live_mode:\n             s = \"\" if num_samples == 1 else \"s\"\n             print(f\"Captured {num_samples:n} sample{s} in {fmt(running_time_sec, 2)} seconds\")\n-            print(f\"Sample rate: {fmt(sample_rate, 2)} samples/sec\")\n+            comparable_samples = max(1, num_samples - errors - 1)\n+            print(f\"Sample rate: {fmt(sample_rate, 2)} samples/sec \"\n+                  f\"(consecutive identical: {consecutive_identical:n}/{comparable_samples:n})\")\n             print(f\"Error rate: {fmt(error_rate, 2)}\")\n \n             # Print unwinder stats if stats collection is enabled\n```\n\n## Discussion\n\nThis hints why RLE in the binary format is so efficient.\n\nI propose a Python-level improvement in #149719, leveraging the fact that `timestamps_us` in the `collect` is plural:\n\nhttps://github.com/python/cpython/blob/b546cc10f5c659344ce3cf49db6d9c92307ed1fc/Lib/profiling/sampling/collector.py#L147\n\nThis gives 3x improvement throughput for `--pstats` for example:\n\n```\n2026-05-12T11:08:55.568015000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main c6fd7de*?) % sudo ./python.exe -m profiling.sampling run -r 300khz --pstats -o /dev/null -m test\n\n[...]\n\n463 tests OK.\n\nTotal duration: 14 min 46 sec\nTotal tests: run=49,788 failures=9 skipped=2,696\nTotal test files: run=494/505 failed=5 env_changed=1 skipped=25 resource_denied=11\nResult: FAILURE\nCaptured 100,236,311 samples in 886.43 seconds\nSample rate: 113,079.14 samples/sec (consecutive identical: 98,417,466/99,721,944)\nError rate: 0.51\nWarning: missed 195239075 samples from the expected total of 295475386 (66.08%)\n```\n\nOn the C-level, there'd be still millions of unnecessary allocations, though.\n\nI did not measure nor explored this yet, but quick shots go along the lines of returning a non-mutable objects from `get_stack_trace()` and friends. Maybe the ideal would be a common `StackTrace`, instead of a list. Another would be to add `prev_stack_trace` (so we don't make the `RemoteUnwinder` stateful) and perhaps return something like same-as-before. \n\nPerhaps we could already think in terms of batches and dedups in the `RemoteUnwinder` layer, instead of `Binary{Writer,Reader}`? cc @LalitMaganti\n\nMy intuition is that it starts to resemble `epoll()`, so my favourite idea is an `async` API where unwinder would wake up the profiler. We'd keep the current API inact, and be able to come up with future-proof types of wake up events to which the consumer could subscribe (eg: new, batch etc.)\n\nI believe that mining binary recordings would also reveal better shaped internal data structs.\n\nI'm not exactly sure about hinting the user so she'd decrease the sampling rate. There still might be new unique data among the sea of duplicates.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-149719\n* gh-149747\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/maurycy","@type":"Person","name":"maurycy"},"datePublished":"2026-05-12T10:52:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/149718/cpython/issues/149718"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c46a6f73-6024-c2c8-dc0d-a6cd09a9638f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC792:238281:1F3B4C7:2A18AFD:6A537B86
html-safe-nonce49c323b2e6e91729f5227c46c4e095abe662f07d7321cc19cc2ccd79f0187483
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzkyOjIzODI4MToxRjNCNEM3OjJBMThBRkQ6NkE1MzdCODYiLCJ2aXNpdG9yX2lkIjoiNDA0NzE4Njk3MDg3MDUxMjUxOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac936f4c580b99abc560aed3159d48fe64ed83e34eb6de1893795876578b94e2ce
hovercard-subject-tagissue:4428455994
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/149718/issue_layout
twitter:imagehttps://opengraph.githubassets.com/69aefa2bc40d06bd44069b8d0b056ebcf4fd750757eac5a83168d614a55afcd7/python/cpython/issues/149718
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/69aefa2bc40d06bd44069b8d0b056ebcf4fd750757eac5a83168d614a55afcd7/python/cpython/issues/149718
og:image:altBug report Bug description: Diagnosis Note the consecutive identical here: 2026-05-12T10:27:01.788483000+0200 maurycy@gimel /Users/maurycy/src/github.com/maurycy/cpython (main c6fd7de*?) % sudo ./p...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemaurycy
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
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
release07a982c1d40157c619b364352b704c3ce66bb332
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/149718#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F149718
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F149718
Sign up https://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/149718
Reloadhttps://github.com/python/cpython/issues/149718
Reloadhttps://github.com/python/cpython/issues/149718
Please reload this pagehttps://github.com/python/cpython/issues/149718
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/149718
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.8k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
_remote_debugging: returning the same samples over and overhttps://github.com/python/cpython/issues/149718#top
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%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 May 12, 2026https://github.com/python/cpython/issues/149718#issue-4428455994
#149719https://github.com/python/cpython/pull/149719
cpython/Lib/profiling/sampling/collector.pyhttps://github.com/python/cpython/blob/b546cc10f5c659344ce3cf49db6d9c92307ed1fc/Lib/profiling/sampling/collector.py#L147
b546cc1https://github.com/python/cpython/commit/b546cc10f5c659344ce3cf49db6d9c92307ed1fc
@LalitMagantihttps://github.com/LalitMaganti
gh-149718: Aggregate same stack frames in Tachyon in some collectors #149719https://github.com/python/cpython/pull/149719
[3.15] gh-149718: Aggregate same stack frames in Tachyon in some collectors (GH-149719) #149747https://github.com/python/cpython/pull/149747
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%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.