GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-126316: Use mutexes in the grp module by vstinner · Pull Request #126504 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Nov 6, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: grp is not thread safe #126316

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-126316: Use mutexes in the grp module
85903fb
@bedevere-app bedevere-app Bot added the awaiting core review label Nov 6, 2024
@vstinner vstinner added the needs backport to 3.13 only security fixes label Nov 6, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Nov 6, 2024
grp is not thread safe #126316
Closed
ZeroIntensity
ZeroIntensity reviewed Nov 6, 2024
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2024-11-06-15-23-29.gh-issue-126316.xBcDse.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity

ZeroIntensity commented Nov 6, 2024

Copy link
Copy Markdown
Member

Actually, we'll need a separate fix for subinterpreters on 3.12, because there's no PyMutex there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner @ZeroIntensity
Update Misc/NEWS.d/next/Library/2024-11-06-15-23-29.gh-issue-126316.x…
e2f9669
…BcDse.rst

Co-authored-by: Peter Bierma <[email protected]>
@vstinner

vstinner commented Nov 6, 2024

Copy link
Copy Markdown
Member Author

Actually, we'll need a separate fix for subinterpreters on 3.12, because there's no PyMutex there.

The regular build (not Free Threaded build) is not affected by #126316 since function calls are serialized by the GIL.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity

ZeroIntensity commented Nov 6, 2024

Copy link
Copy Markdown
Member

Yeah, but a subinterpreter can have its own GIL, so if these functions aren't thread safe on a system level, then it won't be thread safe across multiple interpreters. I think we just need to add a Py_mod_multiple_interpreters module slot with Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED, to indicate that subinterpreters need to use a shared GIL to use the module.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Nov 6, 2024

Copy link
Copy Markdown
Member Author

Yeah, but a subinterpreter can have its own GIL, so if these functions aren't thread safe on a system level, then it won't be thread safe across multiple interpreters.

My change only fix free-threaded build. Should I also change the regular build for this use case?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity

ZeroIntensity commented Nov 6, 2024

Copy link
Copy Markdown
Member

On second thought, I think we should address subinterpreters in another PR for backporting reasons. The fix is what I said with the module slot above.

vstinner reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request Nov 6, 2024
gh-126316: Use critical sections in grp module #126488
Closed
@vstinner

vstinner commented Nov 21, 2024

Copy link
Copy Markdown
Member Author

#127055 was merged instead. I close this issue.

ZeroIntensity reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Nov 21, 2024
@vstinner
vstinner deleted the grp_mutex branch November 21, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeroIntensity ZeroIntensity ZeroIntensity left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review needs backport to 3.13 only security fixes

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@vstinner @ZeroIntensity
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.