# grpc._channel._MultiThreadedRendezvous: <StatusCode.UNAVAILABLE: 14> 流已移除

- **ID:** `grpc/stream-remotely-closed`
- **领域:** grpc
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

服务器因网络中断或服务器端关闭而关闭了 gRPC 流。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| gRPC v1.40.0 | active | — | — |
| gRPC v1.50.0 | active | — | — |
| gRPC v1.60.0 | active | — | — |

## 解决方案

1. ```
   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)
   ```
2. ```
   Check server logs for errors like 'connection reset by peer' and ensure the server is stable. Use a load balancer to distribute connections.
   ```
3. ```
   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.
   ```

## 无效尝试

- **** — The server or network issue persists; client restart doesn't fix the underlying cause. (70% 失败率)
- **** — The error is not about timeout but about stream removal; longer timeouts won't prevent stream closure. (85% 失败率)
- **** — Keepalive pings help detect dead connections; disabling them may delay detection but not prevent stream removal. (60% 失败率)
