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-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() by vstinner · Pull Request #133199 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Apr 30, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Replace _PyObject_GC_UNTRACK() with PyObject_GC_UnTrack() to not fail if the method was already untracked.

  • Issue: Not all types have "trashcan" protection and tp_dealloc can overflow stack #124715

Sorry, something went wrong.

Uh oh!

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

All reactions
@vstinner
pythongh-132280: Fix method_dealloc(): use PyObject_GC_UnTrack()
d09167e
Replace _PyObject_GC_UNTRACK() with PyObject_GC_UnTrack() to not fail
if the method was already untracked.
@vstinner vstinner added the skip news label Apr 30, 2025
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 30, 2025
@vstinner vstinner changed the title gh-132280: Fix method_dealloc(): use PyObject_GC_UnTrack() gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() Apr 30, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Apr 30, 2025
Not all types have "trashcan" protection and tp_dealloc can overflow stack #124715
Closed
@vstinner vstinner mentioned this pull request Apr 30, 2025
GH-124715: Move trashcan mechanism into Py_Dealloc #132280
Merged
@vstinner

vstinner commented Apr 30, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

This change fix test_functools on s390x: #132280 (comment)

But I'm not sure why "Move trashcan mechanism into Py_Dealloc" requires this change.

cc @iritkatriel @markshannon @nascheme

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented Apr 30, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

But I'm not sure why "Move trashcan mechanism into Py_Dealloc" requires this change.

I don't see any reason either.
Is it just s390x showing this failure?

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Is it just s390x showing this failure?

s390x buildbot is fast. Other buildbots are still running. Maybe test_functools will fail on other buildbots, I don't know so far.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Oh, I cannot reproduce the issue on s390x RHEL9 (GCC 11.5.0) nor on s390x Fedora Stable (GCC 14.2.1), only on s390x RHEL8 (GCC 8.5.0).

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 1, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

s390x buildbot is fast. Other buildbots are still running. Maybe test_functools will fail on other buildbots, I don't know so far.

test_functools does also crash on:

  • aarch64 Fedora Stable LTO 3.x: https://buildbot.python.org/#/builders/336/builds/6843
  • aarch64 Fedora Stable Clang 3.x: https://buildbot.python.org/#/builders/234/builds/7548
  • aarch64 Fedora Stable Clang Installed 3.x: https://buildbot.python.org/#/builders/14/builds/7693
  • aarch64 RHEL8 LTO + PGO 3.x: https://buildbot.python.org/#/builders/78/builds/9032
  • AMD64 Fedora Stable Clang 3.x: https://buildbot.python.org/#/builders/441/builds/7851
  • s390x Fedora Stable LTO 3.x: https://buildbot.python.org/#/builders/1654/builds/316
All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 1, 2025

Copy link
Copy Markdown
Member Author

AMD64 Fedora Stable Clang 3.x: https://buildbot.python.org/#/builders/441/builds/7851

I confirm that test_functools does crash randomly when I build Python using clang on my laptop:

$  ./configure --with-pydebug CC=clang LD=clang
$  make
$  ./python -m test -v test_functools 
(...)
test_recursive_pickle (test.test_functools.TestPartialPy.test_recursive_pickle) ...

Objects/classobject.c:247: _PyObject_GC_UNTRACK: Assertion "_PyObject_GC_IS_TRACKED(((PyObject*)(op)))" failed: object not tracked by the garbage collector
All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner
vstinner merged commit 662dd29 into python:main May 1, 2025
@vstinner
vstinner deleted the method_dealloc branch May 1, 2025 11:42
@bedevere-app bedevere-app Bot removed the awaiting core review label May 1, 2025
@vstinner

vstinner commented May 1, 2025

Copy link
Copy Markdown
Member Author

It seems like methods are special and can be untracked by something that I failed to identify when they enter the trashcan mechanism. I hope that only methods are treated in a special way and that other objects don't have to be modified for the recent trashcan change.

All reactions

Sorry, something went wrong.

Uh oh!

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

@markshannon

markshannon commented May 1, 2025 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Does this fix all the buildbots?
If so, let's merge this but keep the issue open so we don't forget to investigate further.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 1, 2025

Copy link
Copy Markdown
Member Author

See also #133261 : test_frame crash randomly on RHEL8, but this time on x86-64.

All reactions

Sorry, something went wrong.

Uh oh!

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

@vstinner

vstinner commented May 1, 2025

Copy link
Copy Markdown
Member Author

Does this fix all the buildbots?

Yes. Buildbots which are back to green:

  • s390x RHEL8 3.x
  • aarch64 Fedora Stable LTO 3.x
  • aarch64 Fedora Stable Clang 3.x
  • aarch64 Fedora Stable Clang Installed 3.x
  • aarch64 RHEL8 LTO + PGO 3.x
  • AMD64 Fedora Stable Clang 3.x

If so, let's merge this but keep the issue open so we don't forget to investigate further.

#124715 is still open.

All reactions

Sorry, something went wrong.

Uh oh!

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

This was referenced May 1, 2025
test_frame does crash randomly on Linux (x86-64, ppc64le, s390x) #133261
Closed
GH-133261: Make sure that the GC doesn't untrack objects in trashcan #133431
Merged
vstinner added a commit to vstinner/cpython that referenced this pull request May 5, 2025
@vstinner
Revert "pythongh-124715: Fix method_dealloc(): use PyObject_GC_UnTrac…
7ce29b0
…k() (python#133199)"

This reverts commit 662dd29.

The root issue was fixed by the
commit f554237.
vstinner added a commit that referenced this pull request May 5, 2025
@vstinner
Revert "gh-124715: Fix method_dealloc(): use PyObject_GC_UnTrack() (#…
c336f1c
…133199)" (#133434)

This reverts commit 662dd29.

The root issue was fixed by the
commit f554237.
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@vstinner @Pranjal095
Revert "pythongh-124715: Fix method_dealloc(): use PyObject_GC_UnTrac…
ad5f435
…k() (python#133199)" (python#133434)

This reverts commit 662dd29.

The root issue was fixed by the
commit f554237.
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

skip news

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