-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Problem
The racedetector reports false positive data races on stack-local variables that cannot actually have data races because each goroutine has its own stack.
Affected Patterns
Fixed in v0.7.2 (Quick Fix)
- ✅ Named return values:
func foo() (result int, err error) - ✅ Function parameters:
func process(x int)
Still Affected (Phase 2)
- ❌ Local variables:
var x intinside function - ❌ Loop variables:
for i, v := range items - ❌ Short-lived variables in expressions
Root Cause
Our AST-based instrumentor lacks escape analysis that the standard Go race detector has (SSA-based with full type information). We instrument ALL variable accesses without knowing if they're stack-local or heap-allocated.
See internal analysis document: FALSE_POSITIVES_ANALYSIS.md
Solution Roadmap
- Phase 1 (v0.7.2): Skip named returns and parameters
- Phase 2: Add heuristics for loop variables, short-lived locals
- Phase 3: Integrate
go/typesfor escape analysis
Related
- Issue [BUG] false positive races found, only half of a race is reported (previous access stack trace not available) #17 (stack trace display)
- Go race detector uses SSA-level instrumentation
Metadata
Metadata
Assignees
Labels
No labels