Skip to content

gh-117657: Fix TSAN race involving import lock - #118523

Merged
colesbury merged 7 commits into
python:mainfrom
colesbury:gh-117657-import-lock
Jun 6, 2024
Merged

colesbury merged 7 commits into
python:mainfrom
colesbury:gh-117657-import-lock

Conversation

@colesbury

@colesbury colesbury commented May 2, 2024 •

Copy link
Copy Markdown
Contributor

This adds a _PyRecursiveMutex type based on PyMutex and uses that for the import lock. This fixes some data races in the free-threaded build and simplifies the import lock code.

This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 0fa9fa3 🤖

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label May 2, 2024
@colesbury colesbury changed the title gh-117657: Use PyMutex based recursive lock for import lock May 31, 2024
@colesbury colesbury added the needs backport to 3.13 only security fixes label May 31, 2024

@DinoV DinoV 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.

Nice!

@colesbury
colesbury merged commit e21057b into python:main Jun 6, 2024
@colesbury
colesbury deleted the gh-117657-import-lock branch June 6, 2024 17:41
@miss-islington-app

Copy link
Copy Markdown

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 6, 2024
This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
(cherry picked from commit e21057b)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app

bedevere-app Bot commented Jun 6, 2024

Copy link
Copy Markdown

GH-120169 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jun 6, 2024
colesbury added a commit that referenced this pull request Jun 6, 2024
…20169)

This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
(cherry picked from commit e21057b)

Co-authored-by: Sam Gross <colesbury@gmail.com>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
This adds a `_PyRecursiveMutex` type based on `PyMutex` and uses that
for the import lock. This fixes some data races in the free-threaded
build and generally simplifies the import lock code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants