EGOAWAY
grpc
network_error
ai_generated
partial
UNAVAILABLE: grpc: 流期间连接关闭: 收到对端的 GOAWAY
UNAVAILABLE: grpc: connection closed during stream: GOAWAY received from peer
ID: grpc/connection-close-during-stream
70%修复率
84%置信度
1证据数
2024-04-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| gRPC v1.59.0 | active | — | — | — |
| gRPC v1.62.0 | active | — | — | — |
| gRPC v1.65.0 | active | — | — | — |
根因分析
对端发送了 HTTP/2 GOAWAY 帧,表示正在关闭或重新加载,导致所有活跃流以不可用状态终止。
English
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.
官方文档
https://httpwg.org/specs/rfc7540.html#GOAWAY解决方案
-
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.
无效尝试
常见但无效的做法:
-
Increasing the client's retry count to 10 or more.
60% 失败
If the server is permanently down, retries will all fail; retries only help with transient conditions.
-
Setting the environment variable GRPC_GOAWAY_MIN_PING_INTERVAL to a very low value.
90% 失败
This controls ping frequency, not GOAWAY handling; it may trigger additional GOAWAYs due to excessive pings.
-
Switching to a different port on the same server.
95% 失败
GOAWAY is sent for the entire server, not a single port; all ports are affected during shutdown.