grpc
network_error
ai_generated
true
UNAVAILABLE: grpc: stream idle timeout reached
ID: grpc/stream-idle-timeout
78%Fix Rate
84%Confidence
1Evidence
2023-11-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| gRPC Go 1.50+ | active | — | — | — |
| gRPC Python 1.50+ | active | — | — | — |
| Nginx gRPC proxy 1.25+ | active | — | — | — |
Root Cause
A streaming RPC has been inactive for too long (no data sent or received) and the server or client closes the stream due to idle timeout configuration.
generic中文
流式RPC长时间不活动(没有发送或接收数据),由于空闲超时配置,服务器或客户端关闭了流。
Official Documentation
https://grpc.io/docs/guides/keepalive/Workarounds
-
88% success Send periodic keepalive pings from client. In Go: grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 30 * time.Second, Timeout: 10 * time.Second}). Set server: keepalive.ServerParameters{MaxConnectionIdle: 5 * time.Minute}
Send periodic keepalive pings from client. In Go: grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 30 * time.Second, Timeout: 10 * time.Second}). Set server: keepalive.ServerParameters{MaxConnectionIdle: 5 * time.Minute} -
80% success Use bidirectional streaming with periodic heartbeat messages. In Python: every 10 seconds send a small protobuf message (e.g., Empty) from client and have server echo it back.
Use bidirectional streaming with periodic heartbeat messages. In Python: every 10 seconds send a small protobuf message (e.g., Empty) from client and have server echo it back.
中文步骤
Send periodic keepalive pings from client. In Go: grpc.WithKeepaliveParams(keepalive.ClientParameters{Time: 30 * time.Second, Timeout: 10 * time.Second}). Set server: keepalive.ServerParameters{MaxConnectionIdle: 5 * time.Minute}Use bidirectional streaming with periodic heartbeat messages. In Python: every 10 seconds send a small protobuf message (e.g., Empty) from client and have server echo it back.
Dead Ends
Common approaches that don't work:
-
Setting keepalive time to 0 (disable)
40% fail
May cause connections to be dropped by network middleboxes that expect periodic traffic.
-
Increasing timeout on server only
35% fail
Client may still have its own idle timeout that triggers first.