go
runtime_error
ai_generated
true
error: goroutine leak detected (channel send blocked)
ID: go/goroutine-leak-channel-block
80%Fix Rate
82%Confidence
0Evidence
2024-05-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.19 | active | — | — | — |
| 1.22 | active | — | — | — |
Root Cause
A goroutine is blocked sending to a channel that no other goroutine reads from.
generic中文
goroutine在向通道发送数据时阻塞,因为没有其他goroutine从该通道读取。
Workarounds
-
95% success
go func() { ch <- data }(); result := <-ch -
90% success
select { case ch <- data: default: /* handle timeout */ }
Dead Ends
Common approaches that don't work:
-
60% fail
Only postpones the problem; buffer fills up eventually.
-
90% fail
Sleep does not fix the root cause; may cause indefinite blocking.