grpc protocol_error ai_generated true

UNAVAILABLE: grpc: 服务器因 max_pings_without_data 发送了 GOAWAY

UNAVAILABLE: grpc: received goaway from server due to max_pings_without_data

ID: grpc/grpc-max-pings-without-data

其他格式: JSON · Markdown 中文 · English
78%修复率
84%置信度
1证据数
2023-11-05首次发现

版本兼容性

版本状态引入弃用备注
gRPC v1.38.0 active
gRPC v1.49.0 active
gRPC v1.58.0 active

根因分析

服务器发送了 GOAWAY 帧,因为客户端在没有数据流的情况下发送了过多保活 ping。

English

The server sent a GOAWAY frame because the client sent too many keepalive pings without any data flow.

generic

官方文档

https://grpc.io/docs/guides/keepalive/#keepalive-configuration

解决方案

  1. Adjust client keepalive settings: reduce grpc.keepalive_time_ms to a higher value (e.g., 300000 ms) and increase grpc.keepalive_timeout_ms. Example in C++: channel_args.SetInt(GRPC_ARG_KEEPALIVE_TIME_MS, 300000);
  2. On the server, set the maximum allowed pings without data using environment variable GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA (e.g., 0 to disable the limit) or via channel args.
  3. Ensure client sends data frames periodically (e.g., by sending health check RPCs) to avoid triggering the ping-only limit.

无效尝试

常见但无效的做法:

  1. 60% 失败

    This may lead to undetected dead connections, causing other errors like 'stream removed'.

  2. 50% 失败

    This can lead to resource exhaustion on the server if many clients ping aggressively.

  3. 85% 失败

    The client will keep sending pings and get GOAWAY repeatedly, causing constant disconnections.