{
  "id": "grpc/connection-close-during-stream",
  "signature": "UNAVAILABLE: grpc: connection closed during stream: GOAWAY received from peer",
  "signature_zh": "UNAVAILABLE: grpc: 流期间连接关闭: 收到对端的 GOAWAY",
  "regex": "UNAVAILABLE: grpc: connection closed during stream",
  "domain": "grpc",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "The peer sent an HTTP/2 GOAWAY frame, indicating it is shutting down or reloading, causing all active streams to be terminated with an unavailable status.",
  "root_cause_type": "generic",
  "root_cause_zh": "对端发送了 HTTP/2 GOAWAY 帧，表示正在关闭或重新加载，导致所有活跃流以不可用状态终止。",
  "versions": [
    {
      "version": "gRPC v1.59.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC v1.62.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "gRPC v1.65.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing the client's retry count to 10 or more.",
      "why_fails": "If the server is permanently down, retries will all fail; retries only help with transient conditions.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting the environment variable GRPC_GOAWAY_MIN_PING_INTERVAL to a very low value.",
      "why_fails": "This controls ping frequency, not GOAWAY handling; it may trigger additional GOAWAYs due to excessive pings.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Switching to a different port on the same server.",
      "why_fails": "GOAWAY is sent for the entire server, not a single port; all ports are affected during shutdown.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Implement client-side retry with exponential backoff and jitter: `from grpc import exponential_backoff; for attempt in range(3): try: response = stub.Call(request); break except grpc.RpcError as e: if e.code() == grpc.StatusCode.UNAVAILABLE: time.sleep(backoff(attempt))`",
      "success_rate": 0.85,
      "how": "Implement client-side retry with exponential backoff and jitter: `from grpc import exponential_backoff; for attempt in range(3): try: response = stub.Call(request); break except grpc.RpcError as e: if e.code() == grpc.StatusCode.UNAVAILABLE: time.sleep(backoff(attempt))`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Configure the server to drain connections gracefully before shutdown by setting a GOAWAY grace period: `server.graceful_shutdown(timeout=30)`",
      "success_rate": 0.8,
      "how": "Configure the server to drain connections gracefully before shutdown by setting a GOAWAY grace period: `server.graceful_shutdown(timeout=30)`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a load balancer or proxy that can redirect traffic to healthy backends during server restarts.",
      "success_rate": 0.9,
      "how": "Use a load balancer or proxy that can redirect traffic to healthy backends during server restarts.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Implement client-side retry with exponential backoff and jitter: `from grpc import exponential_backoff; for attempt in range(3): try: response = stub.Call(request); break except grpc.RpcError as e: if e.code() == grpc.StatusCode.UNAVAILABLE: time.sleep(backoff(attempt))`",
    "Configure the server to drain connections gracefully before shutdown by setting a GOAWAY grace period: `server.graceful_shutdown(timeout=30)`",
    "Use a load balancer or proxy that can redirect traffic to healthy backends during server restarts."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://httpwg.org/specs/rfc7540.html#GOAWAY",
  "official_doc_section": null,
  "error_code": "EGOAWAY",
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.7,
  "resolvable": "partial",
  "first_seen": "2024-04-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}