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 — bpo-46070: Revert "bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)" by vstinner · Pull Request #30564 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Jan 12, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This reverts commit 7247407.

Fix a random crash involving subinterpreters on Windows. Revert the
change which made the gc module state per interpreter: the gc module
state is shared again by all interpreters.

https://bugs.python.org/issue36854

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
vstinner requested review from iritkatriel and pablogsal as code owners January 12, 2022 22:36
@bedevere-bot bedevere-bot added the awaiting core review label Jan 12, 2022
@vstinner
vstinner marked this pull request as draft January 12, 2022 23:23
@vstinner
bpo-46070: Revert "bpo-36854: Move _PyRuntimeState.gc to PyInterprete…
b0bb111
…rState (GH-17287)"

This reverts commit 7247407.

Fix a random crash involving subinterpreters on Windows. Revert the
change which made the gc module state per interpreter: the gc module
state is shared again by all interpreters.
@vstinner vstinner changed the title Revert "bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)" bpo-46070: Revert "bpo-36854: Move _PyRuntimeState.gc to PyInterpreterState (GH-17287)" Jan 12, 2022
ericsnowcurrently
ericsnowcurrently approved these changes Jan 12, 2022
View reviewed changes

@ericsnowcurrently ericsnowcurrently left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

😢

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jan 12, 2022
@ericsnowcurrently

ericsnowcurrently commented Jan 12, 2022

Copy link
Copy Markdown
Member

FTR, this is to resolve https://bugs.python.org/issue46070.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently

ericsnowcurrently commented Jan 12, 2022

Copy link
Copy Markdown
Member

BTW, do we have any sort of reproducer for which we can add a test? That way we don't cause the same problem when we move GC back to PyInterpreterState later.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jan 12, 2022

Copy link
Copy Markdown
Member Author

BTW, do we have any sort of reproducer for which we can add a test?

So far, I was only able to reproduce the crash on Windows with Python 3.9 using win_py399_crash_reproducer.py script of https://bugs.python.org/issue46070 I failed to write a reliable reproducer which works on any platform.

I didn't fully understand the root issue. My theory is that an object is shared by two interprereter. The first interpreter runs a GC collection which traverses this shared object, an object finalizer releases the GIL. Now the second interpreter gets the GIL and also runs a GC collection which traverses the same shared object.

The problem is that the PyGC_Head header cannot be modified by two interpreters in parallel: data races are likely and Python does crash somehow.

Since the bug is a crash and so far nobody managed to fully understand it, IMO it's safer to revert the change for now.

ericsnowcurrently 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.

@ericsnowcurrently

ericsnowcurrently commented Jan 13, 2022

Copy link
Copy Markdown
Member

Your theory sounds plausible.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Jan 13, 2022

Copy link
Copy Markdown
Member Author

I wrote a simpler fix: GH-30577.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner vstinner closed this Jan 13, 2022
@vstinner
vstinner deleted the revert_gc branch January 13, 2022 18:31
@graysky graysky mannequin mentioned this pull request Apr 10, 2022
[subinterpreters] crash when importing _sre in subinterpreters in parallel (Python 3.9 regression) #90228
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericsnowcurrently ericsnowcurrently ericsnowcurrently approved these changes
@iritkatriel iritkatriel Awaiting requested review from iritkatriel
@pablogsal pablogsal Awaiting requested review from pablogsal pablogsal is a code owner
@ZeroIntensity ZeroIntensity Awaiting requested review from ZeroIntensity ZeroIntensity will be requested when the pull request is marked ready for review ZeroIntensity is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 will be requested when the pull request is marked ready for review FFY00 is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting merge

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.

3 participants

@vstinner @ericsnowcurrently @bedevere-bot
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.