go
runtime_error
ai_generated
true
error: context deadline exceeded (goroutine worker)
ID: go/context-deadline-exceeded-worker
80%Fix Rate
86%Confidence
0Evidence
2024-12-08First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.19 | active | — | — | — |
| 1.21 | active | — | — | — |
| 1.22 | active | — | — | — |
Root Cause
A ctx with a deadline expired before the worker finished, often because the deadline was too short or a downstream call is slow.
generic中文
带截止时间的 ctx 在 worker 完成前过期,通常因为截止时间过短或下游调用过慢。
Workarounds
-
90% success
Measure p99 latency and set deadline accordingly; propagate ctx everywhere: ctx, cancel := context.WithTimeout(parent, 5*time.Second) defer cancel()
-
85% success
Add retries with exponential backoff for transient downstream timeouts.
Dead Ends
Common approaches that don't work:
-
80% fail
Eliminates the safety net; slow calls can hang the goroutine indefinitely.
-
70% fail
Arbitrary; if the downstream is genuinely slow, it still times out and the root latency issue remains.