-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
gh-141648: Fix clearing of executors #141649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
| Py_DECREF(e); | ||
| executor->exits[i].executor = NULL; | ||
| if (e != cold && e != cold_dynamic) { | ||
| executor_clear((PyObject *)e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| executor_clear((PyObject *)e); | |
| Py_DECREF(e); |
Using executor_clear could clear a live executor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Py_DECREF doesn't work
The problem is that executors must be forcefully cleared upon invalidation, otherwise their reference cycles prevent clearing of invalid executors and those remain in the bytecode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also executor_clear will never clear a live executor --- executor_clear only, unlinks, detaches, and decrefs an executor, it doesn't call PyObject_GC_DEL on it.
|
When you're done making the requested changes, leave the comment: |
I can't produce a test case. Would appreciate if someone can do so.
The problem is that executors must be forcefully cleared upon invalidation, otherwise their reference cycles prevent clearing of invalid executors and those remain in the bytecode.