Skip to content
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

gh-117657: Fixes a few small TSAN issues in dictobject #118200

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

DinoV
Copy link
Contributor

@DinoV DinoV commented Apr 23, 2024

There's a few spots in the dict implementation where we're not using atomics to access or update the dictionary size. This updates those so that we're using relaxed atomics on them.

The dictobject.h case is a little special because we don't have the FT macros available, so it's special cased with an ifdef.

@DinoV DinoV marked this pull request as ready for review April 23, 2024 23:53
@mpage
Copy link
Contributor

mpage commented Apr 24, 2024

LGTM!

    Keys need atomic relaxed loads as they can be assigned from another thread
    Entries need atomic release assigns so the values they point to are seen
    Reading managed dict needs acquire so that the memory of a newly created and published dictionary is visible
@colesbury colesbury changed the title [gh-117657] Fixes a few small TSAN issues in dictobject gh-117657: Fixes a few small TSAN issues in dictobject Apr 25, 2024
@DinoV DinoV merged commit 5da0280 into python:main Apr 25, 2024
35 checks passed
@DinoV DinoV deleted the nogil_dict_tsan branch May 31, 2024 18:22
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.

3 participants