GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||
GeezerVison is showing github.com — gh-94215: Fix reference count issue in exception_unwind by tiran · Pull Request #94659 · python/cpython Conversation
|
|
🤖 New build scheduled with the buildbot fleet by @tiran for commit 990279b062ac4d61361ef7587e1977879606de52 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
The fix seems to introduce a reference leak: Leaking tests:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@encukou How did you figure out the leaking tests so quickly? I had to figure out that shell one-liner to run each test function separately. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Umm, manually: deleting chunks of the test suite & only keeping the deletion if the leaks stayed at |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
My approach takes longer, but is less manual work. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There's also |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
At the least this seems to be an effective short-term solution. It may be valid for the long-term too. I've left some thoughts on the issue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@tiran, applying this diff to your branch fixes the leaks for me: diff --git a/Python/ceval.c b/Python/ceval.c index 083f881807..e23bfda725 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5683,6 +5683,8 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int err = maybe_call_line_trace(tstate->c_tracefunc, tstate->c_traceobj, tstate, frame, instr_prev); + stack_pointer = _PyFrame_GetStackPointer(frame); + frame->stacktop = -1; if (err) { /* trace function raised an exception */ next_instr++; @@ -5690,9 +5692,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int } /* Reload possibly changed frame fields */ next_instr = frame->prev_instr; - - stack_pointer = _PyFrame_GetStackPointer(frame); - frame->stacktop = -1; } } } @@ -5795,11 +5794,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int /* Pop remaining stack entries. */ PyObject **stackbase = _PyFrame_Stackbase(frame); - if (frame->stacktop != -1) { - // frame_setlineno() may have popped off additional stacks in - // frame_stack_pop(). Re-calculate stack pointer. - stack_pointer = _PyFrame_GetStackPointer(frame); - } while (stack_pointer > stackbase) { PyObject *o = POP(); Py_XDECREF(o); I'm not entirely sure why yet, but my understanding (gained over the last couple of hours) is that ...maybe? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Zero-cost exception handling did not take ``frame_setlineno()`` into account. It can pop off stacks. This can lead to a crash. Exception unwinding now re-calculates the stack pointer. Co-authored-by: Irit Katriel <[email protected]>
990279b to
cee2887
Compare
|
superseded by #94681 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.