You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can you be sure what happens inside a blackhole?
In more seriousness, do we care? The whole point of ioutil.Discard and its devNull type
is to just throw away data. I don't care if multiple goroutines are throwing away data
to the same place.
What are you proposing? Changing the implementation or quieting this warning somehow?
I agree that it's not particularly harmful. But it must be quieted somehow to not fail
tests. I still do not have a suppression mechanism for Go, and I do not want to
introduce it. So the only option for now is changing code. I do not know how to do it,
though (I understand that memory allocation is not a good option performance-wise).
Another point is that if several parallel goroutines write to the same memory it is
slooooooow.
How many oooooohs slow is allocating new memory compared to writing to existing memory
from different threads?
I'm guessing that allocating new memory is slower.
There is no real data race here, of course. Let's be clear about that.
I think the code is fine and can't see a reasonable alternative. ioutil.Discard is kind
of a special case. I don't believe it's worth, say, having a per-goroutine slice to
avoid memory contention.
Well, in C1x it would be an Undefined Behaviour, your box catches fire and
launches nuclear missles.
Go Memory Model is somwhat evasive on this.
I also don't see a reasonable alternative for now. Can we leave this issue
in some postponed state?
It must be somehow solved for ThreadSanitizer - one way or another it must
not produce reports here for user tests. To date I have no special means to
"suppress" some reports, that would be good to preserve.
One possible future solution would be - if/when runtime Processors are
commited and we have support for per-Processor caching (there are exactly
GOMAXPROCS Processors), the blackhole woule be a good candidate for such
caching.
Dmitry, can we detect whether we're being run under TSAN at runtime?
If so, we can arrange for different (slower, more correct) behavior at init() time, just
to quiet these warnings.
Currently it's impossible to detect, because that would require changes to public APIs.
I've done what Russ said. If you wish we may close this issue now.
Activity
robpike commentedon Aug 19, 2012
Comment 1:
Labels changed: added priority-later, removed priority-triage.
Status changed to Accepted.
bradfitz commentedon Aug 19, 2012
Comment 2:
dvyukov commentedon Aug 20, 2012
Comment 3:
bradfitz commentedon Aug 20, 2012
Comment 4:
dvyukov commentedon Aug 20, 2012
Comment 5:
robpike commentedon Aug 20, 2012
Comment 6:
dvyukov commentedon Aug 20, 2012
Comment 7:
rsc commentedon Aug 31, 2012
Comment 8:
bradfitz commentedon Sep 4, 2012
Comment 9:
dvyukov commentedon Sep 6, 2012
Comment 10:
ianlancetaylor commentedon Sep 6, 2012
Comment 11:
Status changed to Fixed.