Skip to content

gh-130547: Fix race between dict_dealloc and split_keys_entry_added #130778

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

Merged
merged 3 commits into from
Mar 4, 2025

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Mar 3, 2025

@corona10
Copy link
Member Author

corona10 commented Mar 3, 2025

Other access case looks fine because of ASSERT_DICT_LOCKED

Copy link
Contributor

@colesbury colesbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -3254,7 +3254,7 @@ dict_dealloc(PyObject *self)
Py_TRASHCAN_BEGIN(mp, dict_dealloc)
if (values != NULL) {
if (values->embedded == 0) {
for (i = 0, n = mp->ma_keys->dk_nentries; i < n; i++) {
for (i = 0, n = FT_ATOMIC_LOAD_SSIZE_RELAXED(mp->ma_keys->dk_nentries); i < n; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also do n = values->capacity, which seems a bit cleaner to me because values->capacity never changes.

@corona10 corona10 requested a review from colesbury March 4, 2025 04:55
@corona10 corona10 requested a review from mpage March 4, 2025 04:55
@corona10 corona10 added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Mar 4, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @corona10 for commit 41387ae 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F130778%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Mar 4, 2025
@corona10
Copy link
Member Author

corona10 commented Mar 4, 2025

!buildbot Refleaks

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @corona10 for commit 41387ae 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F130778%2Fmerge

The command will test the builders whose names match following regular expression: Refleaks

The builders matched are:

  • AMD64 CentOS9 Refleaks PR
  • aarch64 Fedora Stable Refleaks PR
  • PPC64LE Fedora Rawhide Refleaks PR
  • AMD64 Windows11 Refleaks PR
  • PPC64LE Fedora Rawhide NoGIL refleaks PR
  • aarch64 Fedora Rawhide NoGIL refleaks PR
  • AMD64 RHEL8 Refleaks PR
  • AMD64 CentOS9 NoGIL Refleaks PR
  • aarch64 CentOS9 Refleaks PR
  • PPC64LE Fedora Stable Refleaks PR
  • AMD64 Fedora Rawhide Refleaks PR
  • aarch64 RHEL8 Refleaks PR
  • ARM64 MacOS M1 Refleaks NoGIL PR
  • PPC64LE CentOS9 Refleaks PR
  • aarch64 Fedora Rawhide Refleaks PR
  • PPC64LE RHEL8 Refleaks PR
  • s390x RHEL8 Refleaks PR
  • AMD64 Fedora Stable Refleaks PR
  • AMD64 Fedora Rawhide NoGIL refleaks PR
  • s390x RHEL9 Refleaks PR
  • AMD64 FreeBSD Refleaks PR

@corona10
Copy link
Member Author

corona10 commented Mar 4, 2025

Failures looks flasky.

@corona10 corona10 merged commit 80e6d3e into python:main Mar 4, 2025
56 of 61 checks passed
@miss-islington-app
Copy link

Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 4, 2025
@bedevere-app
Copy link

bedevere-app bot commented Mar 4, 2025

GH-130833 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 4, 2025
@corona10 corona10 deleted the gh-130547 branch March 5, 2025 01:41
corona10 added a commit that referenced this pull request Mar 5, 2025
…added (gh-130778) (gh-130833)

gh-130547: Fix race between dict_dealloc and split_keys_entry_added (gh-130778)
(cherry picked from commit 80e6d3e)

Co-authored-by: Donghee Na <[email protected]>
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants