From 950236948893df89f7b0fdd2e3d2cc82ea555894 Mon Sep 17 00:00:00 2001 From: Simo Lin Date: Thu, 5 Mar 2026 18:56:35 -0800 Subject: [PATCH] fix(grpc): add server-side keepalive options to prevent GOAWAY (#19986) Signed-off-by: Simo Lin --- python/sglang/srt/entrypoints/grpc_server.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/sglang/srt/entrypoints/grpc_server.py b/python/sglang/srt/entrypoints/grpc_server.py index e2d92452a..e8ff92a83 100644 --- a/python/sglang/srt/entrypoints/grpc_server.py +++ b/python/sglang/srt/entrypoints/grpc_server.py @@ -1007,6 +1007,12 @@ async def serve_grpc( options=[ ("grpc.max_send_message_length", 1024 * 1024 * 256), ("grpc.max_receive_message_length", 1024 * 1024 * 256), + # Allow client HTTP/2 keepalive pings every 10s+. + # Without this, the gRPC C-core default (300s minimum) causes + # GOAWAY when clients send pings more frequently during long + # requests (e.g. prefill) where no DATA frames flow. + ("grpc.http2.min_recv_ping_interval_without_data_ms", 10000), + ("grpc.keepalive_permit_without_calls", True), ], )