# UNAVAILABLE: grpc: HTTP2 ping timeout after 10s, closing connection

- **ID:** `grpc/http2-ping-timeout`
- **Domain:** grpc
- **Category:** network_error
- **Error Code:** `GRPC_HTTP2_PING_TIMEOUT`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

gRPC client sent HTTP/2 pings but did not receive responses from the server within the timeout period, indicating network issues or server overload.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC v1.48.x | active | — | — |
| gRPC v1.56.x | active | — | — |
| gRPC v1.63.x | active | — | — |

## Workarounds

1. **Increase both client and server keepalive timeout values: set `GRPC_ARG_KEEPALIVE_TIMEOUT_MS` to 20000 (20 seconds) on the client, and ensure server `GRPC_ARG_KEEPALIVE_TIMEOUT_MS` is also increased to match. Example in C++: `channel_args->SetInt(GRPC_ARG_KEEPALIVE_TIMEOUT_MS, 20000);`** (85% success)
   ```
   Increase both client and server keepalive timeout values: set `GRPC_ARG_KEEPALIVE_TIMEOUT_MS` to 20000 (20 seconds) on the client, and ensure server `GRPC_ARG_KEEPALIVE_TIMEOUT_MS` is also increased to match. Example in C++: `channel_args->SetInt(GRPC_ARG_KEEPALIVE_TIMEOUT_MS, 20000);`
   ```
2. **Check network path for packet loss or high latency using tools like `mtr` or `ping`. If behind a load balancer, ensure it supports HTTP/2 ping responses and has an appropriate timeout.** (80% success)
   ```
   Check network path for packet loss or high latency using tools like `mtr` or `ping`. If behind a load balancer, ensure it supports HTTP/2 ping responses and has an appropriate timeout.
   ```
3. **Reduce the keepalive ping interval (`GRPC_ARG_KEEPALIVE_TIME_MS`) to 10000 (10 seconds) to detect failures faster and retry connections sooner.** (75% success)
   ```
   Reduce the keepalive ping interval (`GRPC_ARG_KEEPALIVE_TIME_MS`) to 10000 (10 seconds) to detect failures faster and retry connections sooner.
   ```

## Dead Ends

- **** — This only extends the wait for ping responses; if the network is unreliable, pings still fail, and the connection closes after a longer delay. (65% fail)
- **** — Without pings, idle connections may be dropped by middleboxes (e.g., NATs, load balancers), leading to different errors like connection reset. (55% fail)
- **** — This pings only when streams are active; if the issue is network latency, pings still time out. (60% fail)
