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-123295: Update TSAN suppression comment and sample for set_default_allocator_unlocked #123296

Closed

Conversation

Zheaoli
Copy link
Contributor

@Zheaoli Zheaoli commented Aug 24, 2024

@Zheaoli Zheaoli changed the title gh123295: Update TSAN suppression comment and sample for set_default_allocator_unlocked gh-123295: Update TSAN suppression comment and sample for set_default_allocator_unlocked Aug 24, 2024
@Zheaoli Zheaoli force-pushed the manjusaka/update-tsan-suppressions branch from 2daa7bb to 219bbb5 Compare August 24, 2024 16:25
@Zheaoli Zheaoli force-pushed the manjusaka/update-tsan-suppressions branch from 219bbb5 to 6c2aa25 Compare August 24, 2024 16:29
@colesbury
Copy link
Contributor

You are correct that the race condition also occurs on Linux. It's not operating system specific.

I don't think it's worth changing the comment in the suppressions file.

Would you be interested in addressing the underlying data race? It's described in #111924.

Basically, there are some places where we have to use the default "raw" memory allocator for PyMem_RawMalloc and similar. In those cases it's not safe to use the possibly overridden allocator. Currently, we do this by calling _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, ...) to temporarily restore the default raw memory allocator, but that pattern is not thread-safe because the default allocator is a shared, global variable.

We should add internal-only, non-overridable functions for the default raw memory allocator and use those instead of swapping the global allocator. For example, see _PyMem_DefaultRawMalloc from the nogil-3.12 fork.

@Zheaoli
Copy link
Contributor Author

Zheaoli commented Aug 28, 2024

Would you be interested in addressing the underlying data race? It's described in #111924.

Great, I will try to make it done

@Zheaoli Zheaoli closed this Aug 28, 2024
@Zheaoli Zheaoli deleted the manjusaka/update-tsan-suppressions branch October 15, 2024 20:17
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.

free-threading: set_default_allocator_unlocked is also exits on Linux
2 participants