You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is that during the interpreter finalization, the global event monitors are reset to 0. However, the garbage collection triggered a send to the generator bar which then triggered _Py_Instrument.
is_version_up_to_date is true because the the code was instrumented when last time eval_breaker changed. However, instrumentation_cross_checks would fail, because interp->monitors is reset to 0.
Notice that in the code example above, if the trace function f returns itself rather than None, the assertion failure won't trigger because the generator would not be garbage collected - this might be an instrumentation bug that made the generator uncollectable (I've confirmed that _PyGen_Finalize and gen_close() never executed). However, I did not connect the dots so I don't know why that did not work.
I've made a simple patch in the PR, where I reset the interp->ceval.eval_breaker = 0 in interpreter_clear. It's kind of reasonable but I'm not knowledgeable enough to be confident that this is the/a correct fix.
Bug report
Bug description:
The code above will trigger an assertion added in #109846.
The reason is that during the interpreter finalization, the global event monitors are reset to 0. However, the garbage collection triggered a send to the generator
bar
which then triggered_Py_Instrument
.is_version_up_to_date
is true because the the code was instrumented when last timeeval_breaker
changed. However,instrumentation_cross_checks
would fail, becauseinterp->monitors
is reset to0
.Notice that in the code example above, if the trace function
f
returns itself rather thanNone
, the assertion failure won't trigger because the generator would not be garbage collected - this might be an instrumentation bug that made the generator uncollectable (I've confirmed that_PyGen_Finalize
andgen_close()
never executed). However, I did not connect the dots so I don't know why that did not work.I've made a simple patch in the PR, where I reset the
interp->ceval.eval_breaker = 0
ininterpreter_clear
. It's kind of reasonable but I'm not knowledgeable enough to be confident that this is the/a correct fix.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
ceval.eval_breaker
to 0 ininterpreter_clear
#110753The text was updated successfully, but these errors were encountered: