go
network_error
ai_generated
true
rpc error: code = DeadlineExceeded desc = context deadline exceeded
ID: go/grpc-deadline-exceeded-long-running
80%Fix Rate
90%Confidence
0Evidence
2024-07-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.x | active | — | — | — |
Root Cause
The client set a deadline (via context.WithTimeout or context.WithDeadline) for the RPC, but the server took longer to respond than the allowed time.
generic中文
客户端为 RPC 设置了截止日期(通过 context.WithTimeout 或 context.WithDeadline),但服务器响应时间超过了允许的时间。
Workarounds
-
70% success
Profile the handler and reduce database queries or external calls.
-
80% success
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second); defer cancel(); for i := 0; i < 3; i++ { err := client.Call(ctx, ...); if err == nil { break }; time.Sleep(time.Duration(i)*time.Second) }
Dead Ends
Common approaches that don't work:
-
40% fail
This may hide the underlying performance issue and cause long hangs.
-
90% fail
The server may have partially processed the request, leading to inconsistency.