{
  "id": "go/grpc-deadline-exceeded-context",
  "signature": "rpc error: code = DeadlineExceeded desc = context deadline exceeded",
  "signature_zh": "rpc 错误：代码 = DeadlineExceeded 描述 = 上下文超过截止时间",
  "regex": "rpc\\ error:\\ code\\ =\\ DeadlineExceeded\\ desc\\ =\\ context\\ deadline\\ exceeded",
  "domain": "go",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The client-side or server-side context deadline elapsed before the RPC completed. Common when the server is slow, the network is congested, or the deadline is set too aggressively relative to the handler's work.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 RPC 完成前，客户端或服务端的上下文截止时间已到。常见于服务端处理缓慢、网络拥塞，或相对于处理逻辑而言截止时间设置过短。",
  "versions": [
    {
      "version": "google.golang.org/grpc v1.40+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the server is genuinely overloaded, tight retries amplify load and worsen latency, causing more timeouts. No jitter means thundering herd.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Unbounded calls leak goroutines and hold connections indefinitely when the server hangs, eventually exhausting resources.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\ndefer cancel()\nresp, err := client.Do(ctx, req)\nif status.Code(err) == codes.DeadlineExceeded {\n    // retry with backoff\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "// measure handler latency, then set client deadline > p99\nctx, cancel := context.WithTimeout(ctx, p99Latency*2)\ndefer cancel()",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}