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-116510: Fix crash due to shared immortal interned strings. by nascheme · Pull Request #124646 · python/cpython

Conversation

@nascheme

@nascheme nascheme commented Sep 27, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

  • Issue: CPython 3.12 embedded in WeeChat causes segfault on subsequent calls to Py_EndInterpreter #116510

Sorry, something went wrong.

Uh oh!

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

All reactions
@nascheme
pythongh-116510: Fix crash due to shared immortal interned strings.
a83b5db
@nascheme nascheme added type-crash A hard crash of the interpreter, possibly with a core dump 3.13 only security fixes 3.14 bugs and security fixes needs backport to 3.13 only security fixes labels Sep 27, 2024
@bedevere-app bedevere-app Bot added the awaiting core review label Sep 27, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Sep 27, 2024
CPython 3.12 embedded in WeeChat causes segfault on subsequent calls to Py_EndInterpreter #116510
Closed
@nascheme
nascheme merged commit 98b2ed7 into python:main Sep 27, 2024
@miss-islington-app

miss-islington-app Bot commented Sep 27, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting core review label Sep 27, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 27, 2024
@nascheme @miss-islington
pythongh-116510: Fix crash due to shared immortal interned strings. (p…
40ce65e
…ythongh-124646)

(cherry picked from commit 98b2ed7)

Co-authored-by: Neil Schemenauer <[email protected]>
@bedevere-app

bedevere-app Bot commented Sep 27, 2024

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Sep 27, 2024
@bedevere-bot

bedevere-bot commented Sep 27, 2024

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot iOS ARM64 Simulator 3.x has failed when building commit 98b2ed7.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1380/builds/1423) and take a look at the build logs.
  4. Check if the failure is related to this commit (98b2ed7) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1380/builds/1423

Failed tests:

  • test_support

Failed subtests:

  • test_fd_count - test.test_support.TestSupport.test_fd_count

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/D9F34191-E74B-4D29-B721-2C5A66CE9BF9/data/Containers/Bundle/Application/C6972B3B-1B34-4FF9-A4EE-30CA8E98F224/iOSTestbed.app/python/lib/python3.14/test/test_support.py", line 565, in test_fd_count
    self.assertEqual(more - start, 1)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
AssertionError: 0 != 1
All reactions

Sorry, something went wrong.

Uh oh!

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

@mhsmith

mhsmith commented Sep 27, 2024

Copy link
Copy Markdown
Member

@freakboy3742: It might be a good idea to skip this test on iOS for the same reason as WASM: "The platform starts and stops background threads that use fds". I haven't seen this failure on Android yet, but I did have to skip a similar one in test_fd_leak in test_os.py.

All reactions

Sorry, something went wrong.

Uh oh!

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

@freakboy3742

freakboy3742 commented Sep 27, 2024

Copy link
Copy Markdown
Contributor

@mhsmith Agreed; see #124683

All reactions

Sorry, something went wrong.

Uh oh!

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

Yhg1s pushed a commit that referenced this pull request Sep 27, 2024
@miss-islington @nascheme
[3.13] gh-116510: Fix crash due to shared immortal interned strings. (g…
dc09a0c
…h-124646) (#124648)

gh-116510: Fix crash due to shared immortal interned strings. (gh-124646)
(cherry picked from commit 98b2ed7)

Co-authored-by: Neil Schemenauer <[email protected]>
nascheme added a commit to nascheme/cpython that referenced this pull request Sep 30, 2024
@nascheme
Revert "[3.13] pythongh-116510: Fix crash due to shared immortal inte…
082aae0
…rned strings. (pythongh-124646)"

This reverts commit dc09a0c.
nascheme added a commit to nascheme/cpython that referenced this pull request Sep 30, 2024
@nascheme
pythongh-124785: alternative immortal string cleanup fix
c609173
The pythongh-124646 fix has the issue that it breaks the trace-refs debug
build.  This is a simpler fix that avoids the use-after-free crashes by
just leaking immortal interned strings allocated by legacy
subinterpreters.
nascheme added a commit to nascheme/cpython that referenced this pull request Sep 30, 2024
@nascheme
pythongh-124785: alternative immortal string clear fix
40c78e5
The pythonGH-124646 fix has the issue that it breaks the trace-refs debug
build.  This is a simpler fix that avoids the use-after-free crashes by
just leaking immortal interned strings allocated by legacy
subinterpreters.
@nascheme nascheme mentioned this pull request Sep 30, 2024
[3.13] gh-124785: alternative interned string clear fix #124796
Closed
Yhg1s added a commit to Yhg1s/cpython that referenced this pull request Sep 30, 2024
@Yhg1s
Revert "pythongh-116510: Fix crash due to shared immortal interned st…
48522a8
…rings. (pythongh-124646)"

This reverts commit 98b2ed7.
nascheme pushed a commit that referenced this pull request Sep 30, 2024
@Yhg1s
gh-124785: Revert "gh-116510: Fix crash due to shared immortal intern…
7bdfabe
…ed strings (gh-124646)" (gh-124807)

Revert "gh-116510: Fix crash due to shared immortal interned strings. (gh-124646)"

This reverts commit 98b2ed7.
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 30, 2024
@Yhg1s @miss-islington
pythongh-124785: Revert "pythongh-116510: Fix crash due to shared imm…
7745b1d
…ortal interned strings (pythongh-124646)" (pythongh-124807)

Revert "pythongh-116510: Fix crash due to shared immortal interned strings. (pythongh-124646)"

This reverts commit 98b2ed7.
(cherry picked from commit 7bdfabe)

Co-authored-by: T. Wouters <[email protected]>
@miss-islington miss-islington mentioned this pull request Sep 30, 2024
[3.13] gh-124785: Revert "gh-116510: Fix crash due to shared immortal interned strings (gh-124646)" (gh-124807) #124812
Merged
Yhg1s added a commit that referenced this pull request Oct 1, 2024
@miss-islington @Yhg1s
[3.13] gh-124785: Revert "gh-116510: Fix crash due to shared immortal…
b843974
… interned strings (gh-124646)" (gh-124807) (#124812)

gh-124785: Revert "gh-116510: Fix crash due to shared immortal interned strings (gh-124646)" (gh-124807)

Revert "gh-116510: Fix crash due to shared immortal interned strings. (gh-124646)"

This reverts commit 98b2ed7.
(cherry picked from commit 7bdfabe)

Co-authored-by: T. Wouters <[email protected]>
Yhg1s added a commit to Yhg1s/cpython that referenced this pull request Oct 1, 2024
@Yhg1s
[3.12] pythongh-124785: Revert "pythongh-116510: Fix crash due to sha…
1f0e989
…red immortal interned strings (pythongh-124646)" (pythongh-124807)

Revert "pythongh-116510: Fix crash due to shared immortal interned strings. (pythongh-124646)"

This reverts commit 98b2ed7.
(cherry picked from commit 7bdfabe)

Co-authored-by: T. Wouters <[email protected]>
@Yhg1s Yhg1s mentioned this pull request Oct 1, 2024
[3.12] gh-124785: Revert "gh-116510: Fix crash due to shared immortal interned strings (gh-124646)" (gh-124807) #124818
Closed
ericsnowcurrently added a commit to ericsnowcurrently/cpython that referenced this pull request Oct 1, 2024
@ericsnowcurrently
Revert "pythongh-124785: Revert "pythongh-116510: Fix crash due to sh…
884f398
…ared immortal interned strings (pythongh-124646)" (pythongh-124807)"

This reverts commit 7bdfabe.
@ericsnowcurrently ericsnowcurrently mentioned this pull request Oct 1, 2024
gh-116510: Fix a Crash Due to Shared Immortal Interned Strings #124865
Merged
@nascheme nascheme mentioned this pull request Oct 1, 2024
gh-124785: re-work fix so tracerefs test passes #124808
Closed
ericsnowcurrently added a commit that referenced this pull request Oct 9, 2024
@ericsnowcurrently
gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-12…
f2cb399
…4865)

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785.
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2024
@ericsnowcurrently @miss-islington
pythongh-116510: Fix a Crash Due to Shared Immortal Interned Strings (p…
a5b6574
…ythongh-124865)

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of pythongh-124646 that then addresses the Py_TRACE_REFS
failures identified by pythongh-124785.
(cherry picked from commit f2cb399)

Co-authored-by: Eric Snow <[email protected]>
@miss-islington miss-islington mentioned this pull request Oct 9, 2024
[3.13] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865) #125204
Merged
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2024
@ericsnowcurrently @miss-islington
pythongh-116510: Fix a Crash Due to Shared Immortal Interned Strings (p…
762cb25
…ythongh-124865)

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of pythongh-124646 that then addresses the Py_TRACE_REFS
failures identified by pythongh-124785.
(cherry picked from commit f2cb399)

Co-authored-by: Eric Snow <[email protected]>
@miss-islington miss-islington mentioned this pull request Oct 9, 2024
[3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865) #125205
Merged
encukou pushed a commit that referenced this pull request Nov 12, 2024
@miss-islington @ericsnowcurrently
[3.13] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (…
02cd3ce
…gh-124865) (gh-125709) (GH-125204)

* gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865)

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785.
(cherry picked from commit f2cb399)

Co-authored-by: Eric Snow <[email protected]>

* [3.13] gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709)

They used to be shared, before 3.12.  Returning to sharing them resolves a failure on Py_TRACE_REFS builds.

---------

Co-authored-by: Eric Snow <[email protected]>
ericsnowcurrently added a commit that referenced this pull request Dec 3, 2024
@miss-islington @ericsnowcurrently
[3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (…
49da170
…gh-125205)

Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785 (i.e. backporting gh-125709 too).

(cherry picked from commit f2cb399, AKA gh-124865)

Co-authored-by: Eric Snow <[email protected]>
@mhsmith mhsmith mentioned this pull request Jan 23, 2025
iOS buildbot failure comments don't contain failure details anymore #129248
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

3.13 only security fixes 3.14 bugs and security fixes type-crash A hard crash of the interpreter, possibly with a core dump

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.

4 participants

@nascheme @bedevere-bot @mhsmith @freakboy3742
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 01402503 — 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.