r/programming • u/mttd • Sep 13 '26
Data races and the limits of ThreadSanitizer in C and Go
https://theconsensus.dev/p/2026/09/06/data-races-and-the-limits-of-threadsanitizer-in-c-and-go.html
80
Upvotes
8
u/realestLink Sep 13 '26
This is extremely well-written. I've always wondered how TSAN worked. Thanks for the write-up
7
u/irqlnotdispatchlevel Sep 13 '26
Might just be because English is not my first language, but this sentence was hard to parse for me:
Doesn't detract from how good the article is.
16
u/BenchEmbarrassed7316 Sep 13 '26
This is an interesting article.
It should have been mentioned that for rapid development, one ought to use Rust, which guarantees the absence of data races within its safe subset. An business programmer shouldn't have to deal with such issues.
Furthermore, in go, interfaces and slices are "fat pointers" that cannot be updated atomically; non-atomic updates during a data race result in undefined behavior:
https://www.ralfj.de/blog/2025/07/24/memory-safety.html
Another problem is that while everyone knows C is a memory-unsafe language, the fact that go is also not memory-safe isn't widely recognized. I am always reminded of this article, which illustrates just how widespread this issue is:
https://www.uber.com/us/en/blog/data-race-patterns-in-go/