René's URL Explorer Experiment


Title: Segfault or abort in free-threaded build calling methods from exception in threads · Issue #127192 · python/cpython · GitHub

Open Graph Title: Segfault or abort in free-threaded build calling methods from exception in threads · Issue #127192 · python/cpython

X Title: Segfault or abort in free-threaded build calling methods from exception in threads · Issue #127192 · python/cpython

Description: Crash report What happened? In a no-gil build with PYTHON_GIL=0, it's possible to get the interpreter to segfault or abort with the message Fatal Python error: PyMutex_Unlock: unlocking mutex that is not locked by running the following c...

Open Graph Description: Crash report What happened? In a no-gil build with PYTHON_GIL=0, it's possible to get the interpreter to segfault or abort with the message Fatal Python error: PyMutex_Unlock: unlocking mutex that ...

X Description: Crash report What happened? In a no-gil build with PYTHON_GIL=0, it's possible to get the interpreter to segfault or abort with the message Fatal Python error: PyMutex_Unlock: unlocking mutex t...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Segfault or abort in free-threaded build calling methods from exception in threads","articleBody":"# Crash report\n\n### What happened?\n\nIn a no-gil build with `PYTHON_GIL=0`, it's possible to get the interpreter to segfault or abort with the message `Fatal Python error: PyMutex_Unlock: unlocking mutex that is not locked` by running the following code:\n\n```python\nfrom threading import Thread\nimport email.errors\n\nalive = []\nfor x in range(100):\n    obj = email.errors.InvalidMultipartContentTransferEncodingDefect()\n\n    alive.append(Thread(target=obj.__getstate__, args=()))\n    alive.append(Thread(target=obj.__repr__, args=()))\n    for x in range(20):\n        obj.__init__([\"a\" * (2 ** 16)])\n    alive.append(Thread(target=obj.__init__, args=([\"a\" * (2 ** 16)],)))\n\nfor obj in alive:\n    try:\n        print('START', obj)\n        obj.start()\n    except Exception:\n        pass\n```\nSomehow it seems very hard to trigger a segfault under gdb, so here's the backtrace from the abort:\n```gdb\n#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140736531846720) at ./nptl/pthread_kill.c:44\n#1  __pthread_kill_internal (signo=6, threadid=140736531846720) at ./nptl/pthread_kill.c:78\n#2  __GI___pthread_kill (threadid=140736531846720, signo=signo@entry=6) at ./nptl/pthread_kill.c:89\n#3  0x00007ffff7ce0476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26\n#4  0x00007ffff7cc67f3 in __GI_abort () at ./stdlib/abort.c:79\n#5  0x0000555555944db0 in fatal_error_exit (status=\u003coptimized out>) at Python/pylifecycle.c:3059\n#6  0x00005555559519fb in fatal_error (fd=2, header=header@entry=1,\n    prefix=prefix@entry=0x555555b0bb20 \u003c__func__.0> \"PyMutex_Unlock\",\n    msg=msg@entry=0x555555b0b950 \"unlocking mutex that is not locked\", status=status@entry=-1)\n    at Python/pylifecycle.c:3275\n#7  0x0000555555951a6d in _Py_FatalErrorFunc (\n    func=func@entry=0x555555b0bb20 \u003c__func__.0> \"PyMutex_Unlock\",\n    msg=msg@entry=0x555555b0b950 \"unlocking mutex that is not locked\") at Python/pylifecycle.c:3291\n#8  0x000055555592a36f in PyMutex_Unlock (m=\u003coptimized out>) at Python/lock.c:615\n#9  0x00005555556c6e23 in _PyMutex_Unlock (m=\u003coptimized out>) at ./Include/cpython/lock.h:60\n#10 _PyCriticalSection_End (c=0x7fffc6fcc5f0) at ./Include/internal/pycore_critical_section.h:148\n#11 list_repr (self=\u003coptimized out>) at Objects/listobject.c:581\n#12 0x0000555555709951 in PyObject_Repr (\n    v=[\u003cunknown at remote 0xdddddddddddddddd>, \u003cunknown at remote 0xdddddddddddddddd>, \u003cunknown at remote 0xdddddddddddddddd>, \u003cunknown at remote 0xdddddddddddddddd>]) at Objects/object.c:737\n#13 0x00005555557accbf in unicode_fromformat_arg (writer=writer@entry=0x7fffc6fcc750,\n    f=0x555555a590bc \"R)\", f@entry=0x555555a590bb \"%R)\", vargs=vargs@entry=0x7fffc6fcc700)\n    at Objects/unicodeobject.c:3048\n#14 0x00005555557ad0dd in unicode_from_format (writer=writer@entry=0x7fffc6fcc750,\n    format=format@entry=0x555555a590b8 \"%s(%R)\", vargs=vargs@entry=0x7fffc6fcc7c0)\n    at Objects/unicodeobject.c:3167\n#15 0x00005555557ad287 in PyUnicode_FromFormatV (format=0x555555a590b8 \"%s(%R)\",\n    vargs=vargs@entry=0x7fffc6fcc7c0) at Objects/unicodeobject.c:3201\n#16 0x00005555557ad363 in PyUnicode_FromFormat (format=format@entry=0x555555a590b8 \"%s(%R)\") at Objects/unicodeobject.c:3215\n#17 0x00005555556986fb in BaseException_repr (self=self@entry=0x200005d2aa0) at Objects/exceptions.c:170\n#18 0x000055555574c3f3 in wrap_unaryfunc (self=\u003cInvalidMultipartContentTransferEncodingDefect(line=['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...(truncated), args=\u003coptimized out>, wrapped=0x555555698672 \u003cBaseException_repr>) at Objects/typeobject.c:8947\n#19 0x0000555555691ce5 in wrapperdescr_raw_call (kwds={}, args=(), self=\u003coptimized out>, descr=\u003coptimized out>) at Objects/descrobject.c:531\n#20 wrapper_call (self=self@entry=\u003cmethod-wrapper '__repr__' of InvalidMultipartContentTransferEncodingDefect object at 0x200005d2aa0>, args=args@entry=(), kwds=kwds@entry={}) at Objects/descrobject.c:1438\n#21 0x000055555567f6ef in _PyObject_Call (tstate=0x555555dd7700, callable=callable@entry=\u003cmethod-wrapper '__repr__' of InvalidMultipartContentTransferEncodingDefect object at 0x200005d2aa0>, args=args@entry=(), kwargs=kwargs@entry={}) at Objects/call.c:361\n#22 0x000055555567f811 in PyObject_Call (callable=callable@entry=\u003cmethod-wrapper '__repr__' of InvalidMultipartContentTransferEncodingDefect object at 0x200005d2aa0>, args=args@entry=(), kwargs=kwargs@entry={}) at Objects/call.c:373\n```\nFound using [fusil](https://github.com/devdanzin/fusil) by @vstinner.\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.14.0a2+ experimental free-threading build (heads/main-dirty:a13e94d84bf, Nov 23 2024, 07:16:19) [GCC 11.4.0]","author":{"url":"https://github.com/devdanzin","@type":"Person","name":"devdanzin"},"datePublished":"2024-11-23T11:57:33Z","url":"https://github.com/python/cpython/issues/127192"}

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:3360b3f1-cd2b-15db-7cea-c26b11382c85
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA5C6:2E7DFB:69E98F:8B0B14:6B024B35
html-safe-nonce91abc1623a67b2ab10cbde1a603fbd03baf8e0e9c74400ffa6778734e55cccf2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUM2OjJFN0RGQjo2OUU5OEY6OEIwQjE0OjZCMDI0QjM1IiwidmlzaXRvcl9pZCI6IjM3OTM1NzYzMDc0Njg2ODQwODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac95f01db9cd401564dbf2e5f34ba80b24688112fca9cd2c6aadbb5dd647a89164
hovercard-subject-tagissue:2685921773
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/127192/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f617cffd140f8715a496c457183dc6c12dc17263bc8ea420c5c3c2b25de29fca/python/cpython/issues/127192
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f617cffd140f8715a496c457183dc6c12dc17263bc8ea420c5c3c2b25de29fca/python/cpython/issues/127192
og:image:altCrash report What happened? In a no-gil build with PYTHON_GIL=0, it's possible to get the interpreter to segfault or abort with the message Fatal Python error: PyMutex_Unlock: unlocking mutex that ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedevdanzin
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/127192#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F127192
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%2F127192
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/127192
Reloadhttps://github.com/python/cpython/issues/127192
Reloadhttps://github.com/python/cpython/issues/127192
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/127192
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/127192
Segfault or abort in free-threaded build calling methods from exception in threadshttps://github.com/python/cpython/issues/127192#top
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%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/devdanzin
devdanzinhttps://github.com/devdanzin
on Nov 23, 2024https://github.com/python/cpython/issues/127192#issue-2685921773
fusilhttps://github.com/devdanzin/fusil
@vstinnerhttps://github.com/vstinner
devdanzinhttps://github.com/devdanzin
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 Nov 23, 2024https://github.com/python/cpython/issues/127192#event-15407610391
picnixzhttps://github.com/picnixz
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
on Nov 23, 2024https://github.com/python/cpython/issues/127192#event-15408210225
https://github.com/colesbury
colesburyhttps://github.com/colesbury
on Nov 23, 2024https://github.com/python/cpython/issues/127192#issuecomment-2495552818
https://github.com/devdanzin
devdanzinhttps://github.com/devdanzin
on Nov 23, 2024https://github.com/python/cpython/issues/127192#issuecomment-2495562521
devdanzinhttps://github.com/devdanzin
not plannedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Nov 23, 2024https://github.com/python/cpython/issues/127192#event-15408366659
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/127192
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/127192
3.13only security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.13%22
3.14bugs and security fixeshttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.14%22
interpreter-core(Objects, Python, Grammar, and Parser dirs)https://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22interpreter-core%22
topic-free-threadinghttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-free-threading%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.