grpc
network_error
ai_generated
true
grpc._channel._MultiThreadedRendezvous: <StatusCode.UNAVAILABLE: 14> 流已移除
grpc._channel._MultiThreadedRendezvous: <StatusCode.UNAVAILABLE: 14> Stream removed
ID: grpc/stream-remotely-closed
78%修复率
82%置信度
1证据数
2023-08-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| gRPC v1.40.0 | active | — | — | — |
| gRPC v1.50.0 | active | — | — | — |
| gRPC v1.60.0 | active | — | — | — |
根因分析
服务器因网络中断或服务器端关闭而关闭了 gRPC 流。
English
The server closed the gRPC stream due to a network disruption or server-side shutdown.
官方文档
https://grpc.io/docs/guides/keepalive/解决方案
-
Implement automatic reconnection logic in the client. Example in Python with grpc.aio: async def streaming_rpc(): async with grpc.aio.insecure_channel('localhost:50051') as channel: stub = MyStub(channel); async for response in stub.MyStream(request): process(response) -
Check server logs for errors like 'connection reset by peer' and ensure the server is stable. Use a load balancer to distribute connections.
-
Set the grpc.keepalive_time_ms option on the client to a lower value (e.g., 10000 ms) to detect dead connections faster and reconnect.
无效尝试
常见但无效的做法:
-
70% 失败
The server or network issue persists; client restart doesn't fix the underlying cause.
-
85% 失败
The error is not about timeout but about stream removal; longer timeouts won't prevent stream closure.
-
60% 失败
Keepalive pings help detect dead connections; disabling them may delay detection but not prevent stream removal.