How to track down multi-threading issues?

I have some multithreaded code which is crashing Julia – I suspect the problem is changing the same variable in multiple threads without appropriate locks.

Are there any tools which can help me track down the problem? For example, in C++ I’d try clang’s “thread sanitiser”, or “DRD” from valgrind, which could help me see which variables are being unsafely accessed.

Julia can run under valgrind as well:

https://docs.julialang.org/en/v1/devdocs/valgrind/

I haven’t tried it myself though. I’m not aware of any julia specific tools though. Maybe @tkf knows some more?

1 Like

The single-source-of-truth for the TSAN support is the CI setup for TSAN test:

I think the latest discussion was: CI: add TSAN to the sanitizers pipelines by tkf · Pull Request #42444 · JuliaLang/julia · GitHub There are still some issues and we can’t build “full” julia for using TSAN yet.

I’ve never really used valgrind. I don’t know other tools specific to multi-threading. I use non-specific tools like rr sometimes but I don’t recall anything that could be useful for the situation in the OP.

1 Like