go
network_error
ai_generated
true
rpc 错误:code = Unavailable desc = 连接错误:desc = "transport:http2Client.notifyError 收到通知客户端传输已损坏 EOF"
rpc error: code = Unavailable desc = connection error: desc = "transport: http2Client.notifyError got notified that the client transport was broken EOF"
ID: go/grpc-keepalive-too-frequent
80%修复率
86%置信度
0证据数
2024-09-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| google.golang.org/grpc v1.55+ | active | — | — | — |
根因分析
客户端 keepalive ping 频率高于服务器强制策略允许的值;服务器发送 GOAWAY 并关闭连接。
English
Client keepalive pings are more frequent than the server's enforcement policy allows; the server sends GOAWAY and closes the connection.
解决方案
-
92% 成功率
kp := keepalive.ClientParameters{ Time: 5 * time.Minute, Timeout: 20 * time.Second, PermitWithoutStream: false, } conn, _ := grpc.NewClient(addr, grpc.WithKeepaliveParams(kp), grpc.WithTransportCredentials(insecure.NewCredentials()), ) -
88% 成功率
s := grpc.NewServer(grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ MinTime: 10 * time.Second, PermitWithoutStream: false, }))
无效尝试
常见但无效的做法:
-
70% 失败
Idle connections behind NAT/LB get silently dropped; subsequent RPCs fail with Unavailable.
-
95% 失败
Makes the problem worse — server enforces MinTime and closes the connection faster.