gRPC KeepAlive/idletimeout

Solution 1:

What is happening here is that maybe GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS parameter is true that's why it is sending the pings even without connection.

GRPC_ARG_KEEPALIVE_TIMEOUT_MS is controlling the timeout as written in the documentation:

This channel argument controls the amount of time (in milliseconds) the sender of the keepalive ping waits for an acknowledgement. If it does not receive an acknowledgment within this time, it will close the connection.

You can manually adjust this parameter to control the timeout duration.

Set the GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS to false so it cannot send keepAlive pings when there is no active call.