Programming
VERIFIED FIXES

gRPC Java server returns HTTP/2 GOAWAY under sustained concurrency when keepalive_time is less than proxy idle timeout

Environment

Environment

Java gRPC server (grpc-java 1.56) deployed behind an L7 proxy (NGINX) that enforces upstream idle timeout of 60s. Server sets keepalive_time to 30s and keepalive_permit_without_calls true to detect dead peers quickly.

Symptoms

Symptoms

Under high concurrent RPC load, clients intermittently see HTTP/2 GOAWAY from the server and stream resets; server logs show abrupt connection termination timed around proxy idles. Failures clustered when RPCs extend beyond 60s or when many concurrent idle connections exist.

Observations

Observations

GOAWAY contains debug data pointing at 'ENHANCE_YOUR_CALM' or generic shutdown. tcpdump shows periodic HTTP/2 PINGs from server at 30s intervals and then proxy cutting connection at 60s, which causes server-side connection error handling to send GOAWAY. Reducing keepalive reduces visibility of dead clients but avoids GOAWAYs.

Already attempted

Already attempted

Increased proxy idle timeout to 120s — GOAWAY incidents stopped. Also tried disabling keepalive pings on server — reduced GOAWAY but delayed detection of dead clients. Upgrading grpc-java to latest minor release had no effect.

Question

Question

Why do gRPC Java servers emit GOAWAY when server keepalive pings are more frequent than proxy idle timeout, and what's the safe configuration to avoid GOAWAYs without sacrificing dead-client detection?

COMMUNITY RESPONSES

Verified community troubleshooting

1 reply
0
nordicbyte Answer
user
Posted 4w ago • 0 confirmations

The server was pinging more frequently than the proxy's idle window, so the proxy closed TCP while the server was still active — grpc-java then emits GOAWAY. Fix by matching intervals: set keepalive_time >= proxy idle timeout (or increase the proxy timeout). Alternatively turn off keepalives without active RPCs (keepalive_permit_without_calls=false). After changing, confirm with packet capture that server PINGs no longer precede a proxy close and run your concurrency test to validate.

Showing 1 of 1 community responses
AI DIAGNOSTICS

Incident analysis

Updated 4w ago• Trouble ID

Most likely causes

Keepalive interval shorter than proxy idle timeout causing proxy-initiated TCP close while server still pings 90%
Proxy interprets gRPC keepalive as idle and enforces closure due to misconfiguration 40%
Server-side grpc-java bug in handling connection resets under heavy stream concurrency 20%

Summary

When server sends keepalive PINGs more frequently than the upstream proxy's idle timeout, the proxy may interpret keepalive traffic as activity or, conversely, drop connections it deems idle on its own timeline. If the proxy closes the TCP connection (idle timeout) while the server still expects the connection, the gRPC stack triggers GOAWAY or connection-level errors. Aligning keepalive intervals with proxy timeouts or setting keepalive_permit_without_calls appropriately avoids the mismatch.

Suggested Fixes

Diagnostic step 1
Align gRPC keepalive_time to be greater than or equal to the proxy's upstream idle timeout (e.g., set keepalive_time >= proxy_idle + 5s) or increase proxy idle timeout.
Diagnostic step 2
Set keepalive_permit_without_calls=false if you only need keepalives during active streams, to avoid pinging idle connections.
Diagnostic step 3
Verify with tcpdump that PINGs and proxy timeouts no longer overlap and run load tests to ensure no GOAWAYs are produced.

Continue troubleshooting

Matched from the title, description and tags