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-146452: Fix pickle segfault on concurrent mutation of dict and list by overlorde · Pull Request #146470 · python/cpython Conversation
|
|
The set has a better way of doing this, should we go that way? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (dict_size - total == 1) { | ||
| /* gh-146452: Prevent concurrent dict mutation from | ||
| invalidating the borrowed refs from PyDict_Next(). */ | ||
| Py_BEGIN_CRITICAL_SECTION(obj); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The critical section should be on the outer loop, not just on a single call according to the PyDict_Next() documentation:
Py_BEGIN_CRITICAL_SECTION(self->dict); while (PyDict_Next(self->dict, &pos, &key, &value)) { ... } Py_END_CRITICAL_SECTION();
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.
@vstinner thanks, there are two ways to do this, either go with the current go-to for wrapping up with the critical section, or make a new batch_dict_impl then wrap it with criticial_section_begin or critical_section_end inside the batch_dict. Tradeoff is adding an extra function, but way cleaner than the go-to approach because of its multiple layers of condition check based returns. I'm making a modification to my PR in a while.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
04b34bc to
8f55561
Compare
|
Please avoid |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Admitting the mistake. should i open a new pr again or work on it? i couldn't catch the UBsan failure locally. but another run fixed it on remote. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @overlorde for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-149940 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…in pickle (GH-146470) (#149940) gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (GH-146470) (cherry picked from commit e62a611) Co-authored-by: Farhan Saif <[email protected]> Co-authored-by: Kumar Aditya <[email protected]>
|
Thanks @overlorde for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-150292 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…in pickle (GH-146470) (#150292) gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (GH-146470) (cherry picked from commit e62a611) Co-authored-by: Farhan Saif <[email protected]> Co-authored-by: Kumar Aditya <[email protected]>
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.