FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-129824: fix data races in subinterpreters under TSAN by kumaraditya303 · Pull Request #135794 · python/cpython · GitHub

/ cpython Public

gh-129824: fix data races in subinterpreters under TSAN - #135794

Merged
kumaraditya303 merged 6 commits into
python:mainfrom
kumaraditya303:interppool
Jul 4, 2025
Merged

gh-129824: fix data races in subinterpreters under TSAN#135794
kumaraditya303 merged 6 commits into
python:mainfrom
kumaraditya303:interppool

Conversation

kumaraditya303 commented Jun 21, 2025
edited
Loading

Copy link
Copy Markdown
Contributor

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags are only modified in the main interpreter as all static types are first initialized in main interpreter. With the fix the test_interpreter_pool tests have no data races in typeobject.c under TSAN (there are still some unrelated data races in module exec like posix and struct).

kumaraditya303 added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 23, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit be846e8 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F135794%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 23, 2025

kumaraditya303 commented Jun 25, 2025
edited
Loading

Copy link
Copy Markdown
Contributor Author

This also fixes #116909 so more of test_capi tests can be enabled under free-threading TSAN (will do in follow up).

Comment thread Objects/typeobject.c Outdated
Comment thread Objects/typeobject.c Outdated
kumaraditya303 requested a review from colesbury July 2, 2025 12:57

colesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This looks okay to me, but I don't understand the interaction between type_ready and subinterpreters very well, so I'd appreciate @ericsnowcurrently's review.

ericsnowcurrently left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Mostly LGTM. I've left one mild suggestion and I'll leave it up to you.

FWIW, the relationship with subinterpreters is that the builtin types are "initialized" multiple times. There are certain things that only need to be done the first time, when the main interpreter is initialized, and some that need to be done for each interpreter. This is reflected by "initial".

Comment thread Objects/typeobject.c Outdated
kumaraditya303 enabled auto-merge (squash) July 4, 2025 03:31
kumaraditya303 added the needs backport to 3.14 bugs and security fixes label Jul 4, 2025
kumaraditya303 merged commit b582d75 into python:main Jul 4, 2025

Copy link
Copy Markdown

Thanks @kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 4, 2025
…GH-135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
(cherry picked from commit b582d75)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

bedevere-app Bot commented Jul 4, 2025

Copy link
Copy Markdown

GH-136266 is a backport of this pull request to the 3.14 branch.

Copy link
Copy Markdown

Thanks @kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @kumaraditya303, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker b582d751b4968d4534fdb7894e50713676789b2f 3.13

kumaraditya303 added a commit that referenced this pull request Jul 6, 2025
…5794) (#136266)

gh-129824: fix data races in subinterpreters under TSAN (GH-135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
(cherry picked from commit b582d75)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
AndPuQing pushed a commit to AndPuQing/cpython that referenced this pull request Jul 11, 2025
…#135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…#135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
picnixz pushed a commit to picnixz/cpython that referenced this pull request Jul 13, 2025
…#135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…#135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.

Copy link
Copy Markdown
Member

Reminder about backporting. @kumaraditya303

kumaraditya303 removed the needs backport to 3.13 bugs and security fixes label Aug 15, 2025
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
…#135794)

This fixes the data races in typeobject.c in subinterpreters under free-threading. The type flags and slots are only modified in the main interpreter as all static types are first initialised in main interpreter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL