|
@Jonathan_Blow | |||||
|
doing something that might cause you to miss a real problem later?
|
||||||
|
||||||
|
Jonathan Blow
@Jonathan_Blow
|
2. velj |
|
So I am using ThreadSanitizer, and I find myself cleaning up data races that don't matter, in order to keep the output clean. (For example, an atomic set of a flag, where another thread reads that flag word, but doesn't care about that flag). On the one hand,
|
||
|
|
||
|
Jonathan Blow
@Jonathan_Blow
|
2. velj |
|
this means the diagnostics will be clean from spurious data races, which helps us spot real races. But on the other hand, it can have negative performance impacts on the code, for example by increasing memory use as I introduce more flag words.
|
||
|
|
||
|
Jonathan Blow
@Jonathan_Blow
|
2. velj |
|
It reminds me a little bit of Warning Cleanup Theatre from the 1990s and 2000s (and probably today), where people insert a bunch of casts into their code and now there are no more warnings, so The Code Must Be Better Now With All These Casts. Except data races are more serious.
|
||
|
|
||
|
Jonathan Blow
@Jonathan_Blow
|
2. velj |
|
So I am doing it, but, it doesn't feel totally good to me.
P.S. What is the best practice for getting tsan to shut up if there is an actual data race that you intend to be there and is fine (e.g. a thread polls a location to see if a value shows up there), without
|
||
|
|
||
|
Deftware
@BITPHORIA
|
2. velj |
|
In my experience (which may be entirely unique to me) data races are the product of incompetent threading system design/utilization as a whole, and not specific clear-cut preventable mistakes.
|
||
|
|
||
|
Jonathan Blow
@Jonathan_Blow
|
2. velj |
|
"incompetent", really, that is what you have to say about this?
|
||
|
|
||
|
Meat Cap’n
@jtrberg
|
2. velj |
|
Did you already consider/reject using a suppression file?
|
||
|
|
||
|
Jonathan Blow
@Jonathan_Blow
|
2. velj |
|
Haven't done it yet, just wondering if people with experience in this can let me know of things to watch out for. Silencing things can be scary if you silence the wrong things!
|
||
|
|
||
|
tbodt
@tblodt
|
2. velj |
|
the main tool you have is to put the code that generates the false positive in an inline function and either add that function to the suppression list or annotate it with __attribute__((no_sanitize("thread"))
|
||
|
|
||