GeezerVison is showing github.com — gh-135106: [crash repro] Randomly deposit objects in `_Py_Dealloc` by colesbury · Pull Request #135589 · python/cpython
Conversation
colesbury
commented
Jun 16, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Returns 1 a little less than 1% of the time in
_Py_RecursionLimit_GetMargin() to force the use of the trashcan mechanism.
This isn't intended to be merged. It's just to:
- Demonstrate the crash
- Test on a variety of platforms and configs from the CI
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Returns `1` a little less than 1% of the time in
_Py_RecursionLimit_GetMargin() to force the use of the trashcan
mechanism.
Uh oh!
There was an error while loading. Please reload this page.
colesbury
changed the title
gh-135106: Randomly return 1 in _Py_RecursionLimit_GetMargin
gh-135106: [crash repro] Randomly return 1 in _Py_RecursionLimit_GetMargin
Jun 16, 2025
|
I don't think this shows anything more than that randomly changing the stack limit causes crashes.
The trashcan mechanism relies on the margin being larger for frames higher up the call stack. This breaks that invariant.
You could try changing margin > 2 and margin >= 4 to much larger numbers to see if that provokes a failure.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
colesbury
changed the title
gh-135106: [crash repro] Randomly return 1 in _Py_RecursionLimit_GetMargin
gh-135106: [crash repro] Randomly deposit objects in _Py_Dealloc
Jun 17, 2025
I don't think this shows anything more than that randomly changing the stack limit causes crashes.
The only thing that matters here is the condition to deposit objects -- there's no invariant to be broken. I've updated the test to make that more clear. It should always be safe to deposit an object conservatively (i.e., to treat the available stack as smaller).
Here's the equivalent test with the old trashcan behavior, which works without crashing:
https://github.com/colesbury/cpython/tree/gh-135106-test-old-behavior
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
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.
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.