GRPC_STREAM_IDLE_TIMEOUT
grpc
runtime_error
ai_generated
true
内部错误:gRPC 流 45 因空闲超时关闭
INTERNAL: grpc: stream 45 closed with error: stream idled out
ID: grpc/stream-idle-timeout-reset
82%修复率
85%置信度
1证据数
2024-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| gRPC v1.50.x | active | — | — | — |
| gRPC v1.62.x | active | — | — | — |
| gRPC v1.64.x | active | — | — | — |
根因分析
gRPC 服务器因每流空闲超时配置关闭了空闲流,通常由客户端在超时窗口内未发送数据引起。
English
gRPC server closed an idle stream due to per-stream idle timeout configuration, often caused by client not sending data within the timeout window.
官方文档
https://grpc.io/docs/guides/keepalive/解决方案
-
增加服务器端流空闲超时时间:在 Python 中设置 `grpc.max_connection_idle_ms` 为 60000 毫秒,或 C++ 中设置 `GRPC_ARG_MAX_CONNECTION_IDLE_MS`,避免空闲流过早关闭。
-
客户端定期发送数据或心跳消息(每 10-15 秒),保持流活跃。
-
降低服务器 `max_connection_age_ms` 和 `max_connection_age_grace_ms`,强制连接重新平衡,重置空闲计数器。
无效尝试
常见但无效的做法:
-
70% 失败
Keepalive pings prevent connection-level idle, but per-stream idle timeouts are separate and not affected by keepalive pings.
-
60% 失败
This controls minimum allowed ping interval, not stream idle timeout; it doesn't prevent stream closure due to inactivity.
-
50% 失败
Removing keepalive can cause connection drops, but stream idle timeout is a separate server-side policy that still applies.