Get the latest tech news

Go’s race detector has a mutex blind spot


Go's data race detector can miss possible races in executed code when using mutexes

For example, even if you add a sleep to ensure the threads never actually run simultaneously, Go will still report a race because they access the same variable without synchronization. However, in the original mutex case above, the unguarded write is always executed by thread 1, and yet Go is missing the race unless it actually occurs at runtime. Modeling locks as synchronization points causes blind spots, but this was likely a design decision made to ensure high performance and no false positives.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of mutex blind spot

mutex blind spot

Photo of race detector

race detector