René's URL Explorer Experiment


Title: Creating multiple instances of faulthandler module causes unbalanced refcount on fatal_error.file · Issue #149590 · python/cpython · GitHub

Open Graph Title: Creating multiple instances of faulthandler module causes unbalanced refcount on fatal_error.file · Issue #149590 · python/cpython

X Title: Creating multiple instances of faulthandler module causes unbalanced refcount on fatal_error.file · Issue #149590 · python/cpython

Description: Crash report What happened? In a DEBUG build: import sys, faulthandler, gc faulthandler.enable() del sys.modules["faulthandler"] # we still hold a ref to faulthandler above import faulthandler raises an abort from gc_decref due to negati...

Open Graph Description: Crash report What happened? In a DEBUG build: import sys, faulthandler, gc faulthandler.enable() del sys.modules["faulthandler"] # we still hold a ref to faulthandler above import faulthandler rais...

X Description: Crash report What happened? In a DEBUG build: import sys, faulthandler, gc faulthandler.enable() del sys.modules["faulthandler"] # we still hold a ref to faulthandler above import faultha...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Creating multiple instances of faulthandler module causes unbalanced refcount on fatal_error.file","articleBody":"# Crash report\n\n### What happened?\n\nIn a DEBUG build:\n```python\nimport sys, faulthandler, gc\n\nfaulthandler.enable()\ndel sys.modules[\"faulthandler\"]  # we still hold a ref to faulthandler above\nimport faulthandler\n```\nraises an abort from gc_decref due to negative reference counts.\n\nThis /is/ reproducible in non-debug builds (not the assert/abort, but subsequent use-after-free/segfault, but the reproducer is harder to pin down!)\n\nWith the help of chatgpt, we came up with the following guess of the root cause:\n\n - `_PyRuntime.faulthandler.fatal_error.file` is a global singleton reference\n - faulthandler.enable() sets this value to the relevant file ob\n - Because faulthandler uses multi-phase init, then you can end up with 2 separate instances of the module.\n - When gc runs on the faulthandler instances, they both Py_VISIT the fatal_error.file, causing invalid refcount calculations and the above abort.\n\n\u003cdetails>\n\u003csummary>Stack Trace\u003c/summary>\n\n```\n    frame #0: 0x0000ffffbdb8e13c libc.so.6`___lldb_unnamed_symbol_8e000 + 316\nlibc.so.6`___lldb_unnamed_symbol_8e000:\n->  0xffffbdb8e13c \u003c+316>: cmn    w0, #0x1, lsl #12 ; =0x1000\n    0xffffbdb8e140 \u003c+320>: csneg  w0, wzr, w0, ls\n    0xffffbdb8e144 \u003c+324>: b      0xffffbdb8e0bc ; \u003c+188>\n    0xffffbdb8e148 \u003c+328>: mov    x0, x21\n(lldb) bt\n* thread #1, name = 'python', stop reason = signal SIGABRT\n  * frame #0: 0x0000ffffbdb8e13c libc.so.6`___lldb_unnamed_symbol_8e000 + 316\n    frame #1: 0x0000ffffbdb385fc libc.so.6`raise + 28\n    frame #2: 0x0000ffffbdb22720 libc.so.6`abort + 44\n    frame #3: 0x0000ffffbdb80a98 libc.so.6`___lldb_unnamed_symbol_808e0 + 440\n    frame #4: 0x0000ffffbdb310d8 libc.so.6`__assert_fail + 184\n    frame #5: 0x0000aaaae58931c0 python`visit_decref(op=0x0000ffffbd9747d0, data=\u003cunavailable>) at gcmodule.c:277:9\n    frame #6: 0x0000aaaae57896b4 python`dict_traverse(op=0x0000ffffbda2f2e0, visit=(python`visit_decref at gcmodule.c:269:1), arg=0x0000000000000000) at dictobject.c:2989:17\n    frame #7: 0x0000aaaae5892b84 python`subtract_refs(containers=0x0000aaaae5ac1600) at gcmodule.c:296:16\n    frame #8: 0x0000aaaae58944c0 python`collect(generation=2, n_collected=0x0000ffffe9e2d128, n_uncollectable=0x0000ffffe9e2d130, nofail=0) at gcmodule.c:853:5\n    frame #9: 0x0000aaaae5894aa4 python`collect_with_callback(generation=2) at gcmodule.c:1025:14\n    frame #10: 0x0000aaaae58952b8 python`PyGC_Collect at gcmodule.c:1570:13\n    frame #11: 0x0000aaaae58952fc python`_PyGC_CollectIfEnabled at gcmodule.c:1584:12\n    frame #12: 0x0000aaaae5864720 python`Py_FinalizeEx at pylifecycle.c:1189:5\n    frame #13: 0x0000aaaae5752694 python`pymain_main(pymain=0x0000ffffe9e2d228) at main.c:3127:9\n    frame #14: 0x0000aaaae5752798 python`_Py_UnixMain(argc=\u003cunavailable>, argv=\u003cunavailable>) at main.c:3160:12\n    frame #15: 0x0000aaaae574aab4 python`main(argc=\u003cunavailable>, argv=\u003cunavailable>) at python.c:15:12\n    frame #16: 0x0000ffffbdb22f1c libc.so.6`___lldb_unnamed_symbol_22ea0 + 124\n    frame #17: 0x0000ffffbdb2305c libc.so.6`__libc_start_main + 156\n    frame #18: 0x0000aaaae574a9b0 python`_start + 48\n```\n\n\u003c/details>\n\nBisect was able to reproduce this as far back as I could compile (3.7.17)\nFound on a main non-debug aarch64 musl linux build, isolated on main debug aarch64 musl linux\nreproduced on ubuntu aarch64 (as below)\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.7.17 (tags/v3.7.17:ecd9946c9d1, May  9 2026, 01:29:57) [GCC 15.2.0]\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-150023\n* gh-150037\n* gh-150087\n* gh-150088\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/stestagg","@type":"Person","name":"stestagg"},"datePublished":"2026-05-09T03:00:19Z","url":"https://github.com/python/cpython/issues/149590"}

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:9e3dc1e5-2fd8-65d7-64f0-840d849dccfd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8F7E:269AD9:32943B0:438893E:6B01F367
html-safe-nonce573e1ea0f9210c4b130bd22171830b7141a70ac7a4f2178a7c551934073aa525
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjdFOjI2OUFEOTozMjk0M0IwOjQzODg5M0U6NkIwMUYzNjciLCJ2aXNpdG9yX2lkIjoiNjQ5ODk0OTU2OTgzMTg5MTgxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacfe545410c4717143ac4834b1e93fabd76b86015109927ff96d2b057e4286b5c7
hovercard-subject-tagissue:4410818006
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/149590/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b153ba1f3ae424fca202aeee714ebbc4a643933efa16118fc984dbe814eef10c/python/cpython/issues/149590
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b153ba1f3ae424fca202aeee714ebbc4a643933efa16118fc984dbe814eef10c/python/cpython/issues/149590
og:image:altCrash report What happened? In a DEBUG build: import sys, faulthandler, gc faulthandler.enable() del sys.modules["faulthandler"] # we still hold a ref to faulthandler above import faulthandler rais...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamestestagg
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/149590#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F149590
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%2F149590
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/149590
Reloadhttps://github.com/python/cpython/issues/149590
Reloadhttps://github.com/python/cpython/issues/149590
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/149590
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/149590
Creating multiple instances of faulthandler module causes unbalanced refcount on fatal_error.filehttps://github.com/python/cpython/issues/149590#top
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com/stestagg
stestagghttps://github.com/stestagg
on May 9, 2026https://github.com/python/cpython/issues/149590#issue-4410818006
gh-149590: Remove faulthandler_traverse #150023https://github.com/python/cpython/pull/150023
[3.15] gh-149590: Remove faulthandler_traverse (GH-150023) #150037https://github.com/python/cpython/pull/150037
[3.13] gh-149590: Remove faulthandler_traverse (GH-150023) #150087https://github.com/python/cpython/pull/150087
[3.14] gh-149590: Remove faulthandler_traverse (GH-150023) #150088https://github.com/python/cpython/pull/150088
stestagghttps://github.com/stestagg
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
on May 9, 2026https://github.com/python/cpython/issues/149590#event-25330690241
https://github.com/sergey-miryanov
sergey-miryanovhttps://github.com/sergey-miryanov
on May 9, 2026https://github.com/python/cpython/issues/149590#issuecomment-4411563568
sergey-miryanovhttps://github.com/sergey-miryanov
pendingThe issue will be closed if no feedback is providedhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22pending%22
on May 9, 2026https://github.com/python/cpython/issues/149590#event-25332689990
https://github.com/stestagg
stestagghttps://github.com/stestagg
on May 9, 2026https://github.com/python/cpython/issues/149590#issuecomment-4411834511
StanFromIrelandhttps://github.com/StanFromIreland
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
pendingThe issue will be closed if no feedback is providedhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22pending%22
on May 9, 2026https://github.com/python/cpython/issues/149590#event-25336186822
https://github.com/StanFromIreland
StanFromIrelandhttps://github.com/StanFromIreland
on May 9, 2026https://github.com/python/cpython/issues/149590#issuecomment-4412197897
https://github.com/stestagg
stestagghttps://github.com/stestagg
on May 9, 2026https://github.com/python/cpython/issues/149590#issuecomment-4412216679
JelleZijlstrahttps://github.com/JelleZijlstra
on May 18, 2026https://github.com/python/cpython/issues/149590#event-25680953820
gh-149590: Remove faulthandler_traverse (#150023)https://github.com/python/cpython/commit/56737483c2ffdaadfec648fd38d409c6b10941c0
gh-149590https://github.com/python/cpython/issues/149590
#150023https://github.com/python/cpython/pull/150023
5673748https://github.com/python/cpython/commit/56737483c2ffdaadfec648fd38d409c6b10941c0
[3.15] gh-149590: Remove faulthandler_traverse (GH-150023) (#150037)https://github.com/python/cpython/commit/c417fcabfdd56ed3b7e835ea66117a304d128200
gh-149590https://github.com/python/cpython/issues/149590
GH-150023https://github.com/python/cpython/pull/150023
#150037https://github.com/python/cpython/pull/150037
c417fcahttps://github.com/python/cpython/commit/c417fcabfdd56ed3b7e835ea66117a304d128200
[3.13] gh-149590: Remove faulthandler_traverse (GH-150023) (#150087)https://github.com/python/cpython/commit/44f314933cc86a23b07c5e8df95d5ba425103840
gh-149590https://github.com/python/cpython/issues/149590
GH-150023https://github.com/python/cpython/pull/150023
#150087https://github.com/python/cpython/pull/150087
44f3149https://github.com/python/cpython/commit/44f314933cc86a23b07c5e8df95d5ba425103840
[3.14] gh-149590: Remove faulthandler_traverse (GH-150023) (#150088)https://github.com/python/cpython/commit/fa9773ed9dcc35d49f854e365f7e8bf8452d16e0
gh-149590https://github.com/python/cpython/issues/149590
GH-150023https://github.com/python/cpython/pull/150023
#150088https://github.com/python/cpython/pull/150088
fa9773ehttps://github.com/python/cpython/commit/fa9773ed9dcc35d49f854e365f7e8bf8452d16e0
StanFromIrelandhttps://github.com/StanFromIreland
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 23, 2026https://github.com/python/cpython/issues/149590#event-25879616568
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/149590
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/149590
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%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.