{
  "id": "communication/grpc-client-stream-failed-with-resource-exhausted",
  "signature": "gRPC client stream failed with RESOURCE_EXHAUSTED: Too many outstanding requests",
  "signature_zh": "gRPC 客户端流失败，资源耗尽：待处理请求过多",
  "regex": "RESOURCE_EXHAUSTED: Too many outstanding requests",
  "domain": "communication",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "gRPC client-side flow control or concurrency limit exceeded, causing the channel to reject new streams.",
  "root_cause_type": "generic",
  "root_cause_zh": "gRPC 客户端侧流控制或并发限制超限，导致通道拒绝新流。",
  "versions": [
    {
      "version": "gRPC 1.54.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC 1.60.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC 1.62.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase the gRPC max concurrent streams on the server side only",
      "why_fails": "The issue is client-side concurrency limits; server-side changes don't help.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Restart the client process to reset channel state",
      "why_fails": "Restarting only temporarily clears the queue; the same condition recurs under load.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignore the error and retry indefinitely with backoff",
      "why_fails": "Without addressing the concurrency limit, retries will keep hitting the same error.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Configure gRPC client channel with increased max_concurrent_streams and flow control window: In C++, set `ChannelArguments` with `GRPC_ARG_MAX_CONCURRENT_STREAMS` to 1000 and `GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE` to 64KB. In Python, use `grpc.insecure_channel(target, options=[('grpc.max_concurrent_streams', 1000)])`.",
      "success_rate": 0.85,
      "how": "Configure gRPC client channel with increased max_concurrent_streams and flow control window: In C++, set `ChannelArguments` with `GRPC_ARG_MAX_CONCURRENT_STREAMS` to 1000 and `GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE` to 64KB. In Python, use `grpc.insecure_channel(target, options=[('grpc.max_concurrent_streams', 1000)])`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement client-side rate limiting with a semaphore to limit in-flight requests: Use `asyncio.Semaphore(100)` in Python or `std::counting_semaphore` in C++ to throttle before sending.",
      "success_rate": 0.9,
      "how": "Implement client-side rate limiting with a semaphore to limit in-flight requests: Use `asyncio.Semaphore(100)` in Python or `std::counting_semaphore` in C++ to throttle before sending.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Enable gRPC client-side keepalive with aggressive timeout to detect dead streams: Set `grpc.keepalive_time_ms` to 10000 and `grpc.keepalive_timeout_ms` to 5000.",
      "success_rate": 0.75,
      "how": "Enable gRPC client-side keepalive with aggressive timeout to detect dead streams: Set `grpc.keepalive_time_ms` to 10000 and `grpc.keepalive_timeout_ms` to 5000.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Configure gRPC client channel with increased max_concurrent_streams and flow control window: In C++, set `ChannelArguments` with `GRPC_ARG_MAX_CONCURRENT_STREAMS` to 1000 and `GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE` to 64KB. In Python, use `grpc.insecure_channel(target, options=[('grpc.max_concurrent_streams', 1000)])`.",
    "Implement client-side rate limiting with a semaphore to limit in-flight requests: Use `asyncio.Semaphore(100)` in Python or `std::counting_semaphore` in C++ to throttle before sending.",
    "Enable gRPC client-side keepalive with aggressive timeout to detect dead streams: Set `grpc.keepalive_time_ms` to 10000 and `grpc.keepalive_timeout_ms` to 5000."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://grpc.io/docs/guides/error-codes/",
  "official_doc_section": null,
  "error_code": "RESOURCE_EXHAUSTED",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}