Skip to content

Add ThreadSanitzer hooks for jl_mutex_t #59034

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xal-0
Copy link
Member

@xal-0 xal-0 commented Jul 18, 2025

Lets us detect lock order inversions on jl_mutex_ts, races on mutex initialization, and shows the list of locked mutexes when some other ThreadSanitizer warning is shown.

@xal-0 xal-0 added the multithreading Base.Threads and related functionality label Jul 18, 2025
@vchuravy
Copy link
Member

Very cool! Would it make sense to also push this into user code, so that the locks written in Julia code support this?

@xal-0
Copy link
Member Author

xal-0 commented Jul 18, 2025

That's the plan, though it will require some codegen hacks to make everything bootstrap fast enough. If the decision to include the call to the hooks is made in Julia, we won't easily be able to cross compile the sysimage from a non-tsan version of Julia.

@vchuravy
Copy link
Member

Can we put it in build_h.jl(

@printf "%s\n" "const BUILD_TRIPLET = \"$(BB_TRIPLET_LIBGFORTRAN_CXXABI)\"" >> $@
)? Or is the cross-compile going to use the one from the "host"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants