grpc
network_error
ai_generated
true
已取消:服务器关闭导致流关闭
CANCELLED: grpc: stream closed by server shutdown
ID: grpc/stream-interrupted-by-shutdown
80%修复率
82%置信度
1证据数
2023-09-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| gRPC Python 1.46.0 | active | — | — | — |
| gRPC Go 1.50.0 | active | — | — | — |
根因分析
服务器正在正常关闭,导致所有活跃流被关闭。
English
The server is gracefully shutting down, closing all active streams.
官方文档
https://grpc.io/docs/guides/error-handling/解决方案
-
Implement client-side reconnection logic with exponential backoff. Example in Python: `channel = grpc.insecure_channel('target', options=[('grpc.service_config', '{"methodConfig": [{"name": [{}], "retryPolicy": {"maxAttempts": 5, "initialBackoff": "0.1s", "maxBackoff": "1s", "backoffMultiplier": 2, "retryableStatusCodes": ["UNAVAILABLE"]}}]}')])` -
Use a load balancer to route requests to healthy server instances.
无效尝试
常见但无效的做法:
-
80% 失败
The server is down; retries will fail until the server is back.
-
60% 失败
Keepalive settings do not prevent server shutdown from closing streams.
-
95% 失败
The stream is permanently closed; a new stream must be created.