go
runtime_error
ai_generated
true
fatal error: all goroutines are asleep - deadlock!
ID: go/fatal-error-all-goroutines-asleep-deadlock
80%Fix Rate
90%Confidence
0Evidence
2024-01-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.0+ | active | — | — | — |
Root Cause
All goroutines are blocked waiting on channels/locks with no possibility of progress; the Go runtime deadlock detector fires.
generic中文
所有 goroutine 都阻塞在 channel 或锁上,无法继续推进,Go 运行时死锁检测器触发。
Workarounds
-
95% success
ch := make(chan int, 1) ch <- 1 // no receiver needed for buffered channel
-
90% success
select { case v := <-ch: _ = v case <-time.After(time.Second): return errors.New("timeout") }
Dead Ends
Common approaches that don't work:
-
90% fail
Sleep does not unblock the sender; the deadlock detector still fires once all goroutines park.
-
95% fail
fatal error from the runtime is not recoverable via recover(); it calls exit directly.