Uh oh!
There was an error while loading. Please reload this page.
gh-130313: Avoid locking when clearing objects - #130126
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
colesbury
left a comment
There was a problem hiding this comment.
See comment about clear_inline_values, but otherwise LGTM.
It might be worth running the refleak build bots because these code paths are tricky.
| clear_inline_values(PyDictValues *values) | ||
| { | ||
| if (values->valid) { | ||
| values->valid = 0; |
There was a problem hiding this comment.
Does this need to be FT_ATOMIC_STORE_UINT8(values->valid, 0) for the call from set_dict_inline_values?
There's no need for us to lock the object when clearing the managed dict. We may need to lock the dict if it's been materialized and points to external objects as we could be doing a simple free of the object while other things refer to the dict.
This requires us to relax an assert because we clear objects after we've restarted the world. But we're past the point of resurrection so no one else can be referring to this object.
https://github.com/facebookexperimental/free-threading-benchmarking/tree/main/results/bm-20250214-3.14.0a5+-c00cd86-NOGIL