René's URL Explorer Experiment


Title: 22 free-threading race conditions · Issue #149816 · python/cpython · GitHub

Open Graph Title: 22 free-threading race conditions · Issue #149816 · python/cpython

X Title: 22 free-threading race conditions · Issue #149816 · python/cpython

Description: Bug report Changes 2026-05-13: Filed issue. 2026-06-08: Added new findings (16) and (86). Bug description I found 22 free-threading race conditions during a partial Xint Code scan of cpython. These only apply to the free-threaded build, ...

Open Graph Description: Bug report Changes 2026-05-13: Filed issue. 2026-06-08: Added new findings (16) and (86). Bug description I found 22 free-threading race conditions during a partial Xint Code scan of cpython. These...

X Description: Bug report Changes 2026-05-13: Filed issue. 2026-06-08: Added new findings (16) and (86). Bug description I found 22 free-threading race conditions during a partial Xint Code scan of cpython. These...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"22 free-threading race conditions","articleBody":"# Bug report\n\n### Changes\n\n_2026-05-13_: Filed issue.\n_2026-06-08_: Added new findings (16) and (86).\n\n### Bug description\n\nI found 22 free-threading race conditions during a partial Xint Code scan of cpython. These only apply to the free-threaded build, and were all found and tested on commit 0534774a472424f6b9be2dc4ce9784384bc02401 built with `./configure --disable-gil --enable-asan` on an M3 Mac.\n\nI'm attaching a zip file with detailed writeups of each, as well as reproduction cases for 15 of the 22 issues. I don't have scripts reproducing the findings numbered 21, 36, 82, 94, 106, 115, or 124. Race conditions can be difficult to trigger, and even the scripts I provided are trying to win tight races and may not always work.\n\nI know this is a lot. @colesbury suggested I create a combined issue to make the triage discussion easier.\n\nLet me know if you have any questions or concerns. The issues were found and written up by an automated system, but I have put additional work into the validation and reporting. I do want to be respectful of everyone's time while helping to make Python better.\n\n### Writeups\n\n_2026-05-13_: Initial writeups and test scripts: [cpython-ft.zip](https://github.com/user-attachments/files/27737442/cpython-ft.zip)\n_2026-06-08_: New writeups and test scripts for (16) and (86): [cpython-ft-2026-06-08.zip](https://github.com/user-attachments/files/28698891/cpython-ft-2026-06-08.zip)\n\nMany of the scripts are expected to crash, however some of them only produce exceptions or corrupted output. You should be able to run any of the scripts with `PYTHON_GIL=1` set in your environment if you want to see a baseline without the race condition.\n\n### Finding List\n\n- [ ] (16) Cross-interpreter syslog race\n- [x] ([17](https://github.com/python/cpython/issues/149816)) Unlocked `__init__` races with PRNG state access in `Modules/_randommodule.c`\n- [ ] (21) Racy EVP_MD cache overwrite leaks references in `Modules/_hashopenssl.c`\n- [x] (36) Borrowed type lookup races to use-after-free in `Objects/typeobject.c`\n- [x] ([49](https://github.com/python/cpython/pull/150018)) SNI callback callable race use-after-free in `Modules/_ssl.c`\n- [ ] ([61](https://github.com/python/cpython/pull/150247)) Racy weakref head load before incref in `Objects/typeobject.c`\n- [ ] (62) Concurrent kwargs growth causes heap overwrite in `Objects/call.c`\n- [ ] (69) Unsynchronized extra pointer dereference in len in `Modules/_elementtree.c`\n- [x] ([82](https://github.com/python/cpython/pull/149936)) Non-atomic list slot memmove in shared list delete in `Objects/listobject.c`\n- [x] ([84](https://github.com/python/cpython/pull/150295)) Iterator path bypasses buffered object lock in `Modules/_io/bufferedio.c`\n- [ ] (86) Cross-interpreter XID registry race\n- [ ] (87) Unsynchronized Element.text borrowed-pointer race in `Modules/_elementtree.c`\n- [x] (89) Unsynchronized dict iteration causes borrowed-ref UAF in `Modules/_pickle.c`\n- [x] ([91](https://github.com/python/cpython/pull/150024)) Racy list item borrow causes UAF in `Modules/_pickle.c`\n- [ ] (94) Async-exception setter races thread-state free in `Python/pystate.c`\n- [ ] (96) Racy GC callback list iteration in `Python/gc_free_threading.c`\n- [ ] (106) Immediate decref races lock-free reader in `Modules/_ctypes/_ctypes.c`\n- [ ] (108) Borrowed dict used after lock release in `Objects/dictobject.c`\n- [x] ([115](https://github.com/python/cpython/pull/149914)) Split clear frees keys without QSBR in `Objects/dictobject.c`\n- [ ] (124) Stale keys race in attribute hint fastpath in `Python/bytecodes.c`\n- [x] (125 [wontfix](https://github.com/python/cpython/issues/149816#issuecomment-4446913117)) Struct reinit races with pack/unpack in `Modules/_struct.c`\n- [x] ([128](https://github.com/python/cpython/pull/149909)) Borrowed list item raced before incref in `Objects/bytesobject.c`\n- [ ] (129) Reentrant `__index__` causes released-buffer dereference in `Objects/memoryobject.c`\n- [x] ([132](https://github.com/python/cpython/pull/149858#issue-4452501611)) Non-atomic exports race in memoryview.hex in `Objects/memoryobject.c`\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-149824\n* gh-149858\n* gh-149875\n* gh-149876\n* gh-149877\n* gh-149909\n* gh-149911\n* gh-149912\n* gh-149914\n* gh-149918\n* gh-149936\n* gh-149997\n* gh-149998\n* gh-150000\n* gh-150003\n* gh-150004\n* gh-150024\n* gh-150029\n* gh-150018\n* gh-150099\n* gh-150100\n* gh-150168\n* gh-150247\n* gh-150295\n* gh-150305\n* gh-150306\n* gh-152296\n* gh-153019\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/lunixbochs","@type":"Person","name":"lunixbochs"},"datePublished":"2026-05-14T01:02:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/149816/cpython/issues/149816"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e4ac4ca8-c16e-3fce-26f3-cdf90f3d2cc8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEAC0:1874B4:259121:32B7DC:6A51894E
html-safe-noncee270ee39c76489d863a669b72739bebcdb1d7d0374d9a0c6d3bce00b1da506cf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUMwOjE4NzRCNDoyNTkxMjE6MzJCN0RDOjZBNTE4OTRFIiwidmlzaXRvcl9pZCI6IjQ4NjAyNzA3NDcyNTQzNjAzOTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac79221e14d8cf6c20ee97a675d8c4a0c6a58b02ea141b550d4f99812e2a48de69
hovercard-subject-tagissue:4442224953
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/149816/issue_layout
twitter:imagehttps://opengraph.githubassets.com/59579542c8a2ebb323199808a4763eac4d629eb823c7ee5698fdde4f316c29ef/python/cpython/issues/149816
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/59579542c8a2ebb323199808a4763eac4d629eb823c7ee5698fdde4f316c29ef/python/cpython/issues/149816
og:image:altBug report Changes 2026-05-13: Filed issue. 2026-06-08: Added new findings (16) and (86). Bug description I found 22 free-threading race conditions during a partial Xint Code scan of cpython. These...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelunixbochs
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
releasecb77a7b8b06cd86c243be33fd8e7922d70a9d243
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/149816#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F149816
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%2F149816
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/149816
Reloadhttps://github.com/python/cpython/issues/149816
Reloadhttps://github.com/python/cpython/issues/149816
Please reload this pagehttps://github.com/python/cpython/issues/149816
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/149816
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.7k 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
#150247https://github.com/python/cpython/pull/150247
22 free-threading race conditionshttps://github.com/python/cpython/issues/149816#top
#150247https://github.com/python/cpython/pull/150247
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-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/lunixbochs
lunixbochshttps://github.com/lunixbochs
on May 14, 2026https://github.com/python/cpython/issues/149816#issue-4442224953
0534774https://github.com/python/cpython/commit/0534774a472424f6b9be2dc4ce9784384bc02401
@colesburyhttps://github.com/colesbury
cpython-ft.ziphttps://github.com/user-attachments/files/27737442/cpython-ft.zip
cpython-ft-2026-06-08.ziphttps://github.com/user-attachments/files/28698891/cpython-ft-2026-06-08.zip
17https://github.com/python/cpython/issues/149816
49https://github.com/python/cpython/pull/150018
61https://github.com/python/cpython/pull/150247
82https://github.com/python/cpython/pull/149936
84https://github.com/python/cpython/pull/150295
91https://github.com/python/cpython/pull/150024
115https://github.com/python/cpython/pull/149914
wontfixhttps://github.com/python/cpython/issues/149816#issuecomment-4446913117
128https://github.com/python/cpython/pull/149909
132https://github.com/python/cpython/pull/149858#issue-4452501611
gh-149816: Fix a RC in _random.Random.__init__ method #149824https://github.com/python/cpython/pull/149824
gh-149816: Fix race condition in memoryview with free-threading #149858https://github.com/python/cpython/pull/149858
[3.15] gh-149816: Fix race condition in memoryview with free-threading (GH-149858) #149875https://github.com/python/cpython/pull/149875
[3.14] gh-149816: Fix race condition in memoryview with free-threading (GH-149858) #149876https://github.com/python/cpython/pull/149876
[3.13] gh-149816: Fix race condition in memoryview with free-threading (GH-149858) #149877https://github.com/python/cpython/pull/149877
gh-149816: Fix a race condition in _PyBytes_FromList with free-threading #149909https://github.com/python/cpython/pull/149909
[3.15] gh-149816: Fix a race condition in _PyBytes_FromList with free-threading (GH-149909) #149911https://github.com/python/cpython/pull/149911
[3.14] gh-149816: Fix a race condition in _PyBytes_FromList with free-threading (GH-149909) #149912https://github.com/python/cpython/pull/149912
gh-149816: fix dict.clear() race on split-table dict with non-embedded values #149914https://github.com/python/cpython/pull/149914
gh-149816: Fix race conditions in Modules/_elementtree.c with free-threaded #149918https://github.com/python/cpython/pull/149918
gh-149816: fix thread safety of deletion of list slice #149936https://github.com/python/cpython/pull/149936
[3.15] gh-149816: Fix a RC in _random.Random.__init__ method (GH-149824) #149997https://github.com/python/cpython/pull/149997
[3.14] gh-149816: Fix a RC in _random.Random.__init__ method (GH-149824) #149998https://github.com/python/cpython/pull/149998
[3.15] gh-149816: fix dict.clear() race on split-table dict with non-embedded values (GH-149914) #150000https://github.com/python/cpython/pull/150000
[3.15] gh-149816: fix thread safety of deletion of list slice (GH-149936) #150003https://github.com/python/cpython/pull/150003
[3.14] gh-149816: fix thread safety of deletion of list slice (GH-149936) #150004https://github.com/python/cpython/pull/150004
gh-149816: Fix UAF in Modules/_pickle.c #150024https://github.com/python/cpython/pull/150024
gh-149816: #96 Fix a race condition in invoke_gc_callback with free threading #150029https://github.com/python/cpython/pull/150029
gh-149816: Fix SNI callback callable race #150018https://github.com/python/cpython/pull/150018
[3.15] gh-149816: Fix SNI callback callable race (GH-150018) #150099https://github.com/python/cpython/pull/150099
[3.14] gh-149816: Fix SNI callback callable race (GH-150018) #150100https://github.com/python/cpython/pull/150100
gh-149816: fix concurrent kwargs growth in _thread.start_new_thread #150168https://github.com/python/cpython/pull/150168
gh-149816: Fix race in subtype_getweakref in free-threading build #150247https://github.com/python/cpython/pull/150247
gh-149816: add missing critical section on self in buffered_iternext #150295https://github.com/python/cpython/pull/150295
[3.15] gh-149816: add missing critical section on self in buffered_iternext (GH-150295) #150305https://github.com/python/cpython/pull/150305
[3.14] gh-149816: add missing critical section on self in buffered_iternext (GH-150295) #150306https://github.com/python/cpython/pull/150306
gh-149816: Fix race between setattr and object.__dict__ update #152296https://github.com/python/cpython/pull/152296
gh-149816: fix a race when fetching OpenSSL digests #153019https://github.com/python/cpython/pull/153019
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-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.