GRPC请求遭客户端取消排查:已设无限超时仍报错
问题:gRPC异步调用1分钟后全部被取消,报错StatusCode.CANCELLED
背景
- 基于gRPC官方Python异步示例搭建客户端/服务端,服务端通过聚合大量请求提升效率,导致单请求payload较大,处理时长约20秒
- 使用1台本地服务端+20个asyncio异步客户端进行压测,初始请求可正常处理,约1分钟后所有调用全部失败
报错信息
Received error: %s <AioRpcError of RPC that terminated with: status = StatusCode.CANCELLED details = "CANCELLED" debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"CANCELLED", grpc_status:1, created_time:"2024-07-22T10:29:05.205259898+02:00"}"
已尝试的配置(未解决问题)
服务端配置
server_options = [ ("grpc.keepalive_time_ms", 99999999), ("grpc.keepalive_timeout_ms", 9999999), ("grpc.http2.min_ping_interval_without_data_ms", 9999999), ("grpc.max_connection_idle_ms", 99999999), ("grpc.max_connection_age_ms", 99999999), ("grpc.max_connection_age_grace_ms", 99999999), ("grpc.http2.max_pings_without_data", 5), ("grpc.keepalive_permit_without_calls", 1), ]
客户端配置
client_options = [ ('grpc.max_send_message_length', 50 * 1024 * 1024), # 50 MB ('grpc.max_receive_message_length', 50 * 1024 * 1024), # 50 MB ("grpc.keepalive_time_ms", 999999999), ("grpc.keepalive_timeout_ms", 99999999), ("grpc.http2.max_pings_without_data", 5), ("grpc.keepalive_permit_without_calls", 1) ]
核心疑问
- 请求被取消的具体原因是什么?
- 取消操作的发起方是客户端还是服务端?
内容的提问来源于stack exchange,提问作者amro4934
相关产品推荐
相关产品推荐

