{
  "id": "api/grpc-error-deadline-exceeded-streaming",
  "signature": "gRPC error: DEADLINE_EXCEEDED: Stream closed with deadline exceeded",
  "signature_zh": "gRPC 错误：DEADLINE_EXCEEDED：流因超时而关闭",
  "regex": "gRPC error: DEADLINE_EXCEEDED: Stream closed with deadline exceeded",
  "domain": "api",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A gRPC streaming RPC exceeded its configured deadline (timeout) due to slow server processing or network latency, causing the stream to be terminated.",
  "root_cause_type": "generic",
  "root_cause_zh": "gRPC 流式 RPC 因服务器处理缓慢或网络延迟而超过了配置的截止时间（超时），导致流被终止。",
  "versions": [
    {
      "version": "gRPC 1.50+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC-Go 1.50+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC-Java 1.50+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC-Python 1.50+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This only masks the issue; if the server is slow, the stream may still timeout or the client may hang indefinitely.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This can lead to resource leaks and hangs; also, the server may still enforce its own deadline.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This changes the API contract and may break functionality that relies on streaming.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set a reasonable deadline on the client and implement retries with backoff. Example in Go:\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\nstream, err := client.StreamingRPC(ctx, req)\nif err == context.DeadlineExceeded {\n    // Implement retry logic\n    time.Sleep(2 * time.Second)\n    // Retry with new context\n}",
      "success_rate": 0.85,
      "how": "Set a reasonable deadline on the client and implement retries with backoff. Example in Go:\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\nstream, err := client.StreamingRPC(ctx, req)\nif err == context.DeadlineExceeded {\n    // Implement retry logic\n    time.Sleep(2 * time.Second)\n    // Retry with new context\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Optimize server-side processing to reduce latency, such as by using connection pooling or caching.",
      "success_rate": 0.8,
      "how": "Optimize server-side processing to reduce latency, such as by using connection pooling or caching.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If network latency is high, use a gRPC proxy or consider deploying the server closer to the client.",
      "success_rate": 0.75,
      "how": "If network latency is high, use a gRPC proxy or consider deploying the server closer to the client.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Set a reasonable deadline on the client and implement retries with backoff. Example in Go:\nctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\ndefer cancel()\nstream, err := client.StreamingRPC(ctx, req)\nif err == context.DeadlineExceeded {\n    // Implement retry logic\n    time.Sleep(2 * time.Second)\n    // Retry with new context\n}",
    "Optimize server-side processing to reduce latency, such as by using connection pooling or caching.",
    "If network latency is high, use a gRPC proxy or consider deploying the server closer to the client."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://grpc.io/docs/guides/deadlines/",
  "official_doc_section": null,
  "error_code": "4",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2023-09-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}