With one of the last PRs we have introduce a proper shutdown of ManagedChannels in case of reconnection attempts after connection loss or a NotLeaderException.
This shutdown did not use the graceful shutdown() of the channel but the forced shutdown of the channel using shutdownNow(). This might interfere with running gRPC operations which are not properly aborted. Tests have shown that these running gRPC operations just do not complete aka a client is waiting indefinitely for the result.
To avoid this the channel should be closed using the same approach as closing the channel on shutdown: applying first a graceful shutdown and then if necessary perform a forced shutdown after this grace period.
This also improves code reuse and reduces complexity in the GrpcClient.
With one of the last PRs we have introduce a proper shutdown of
ManagedChannels
in case of reconnection attempts after connection loss or a NotLeaderException. This shutdown did not use the gracefulshutdown()
of the channel but the forced shutdown of the channel usingshutdownNow()
. This might interfere with running gRPC operations which are not properly aborted. Tests have shown that these running gRPC operations just do not complete aka a client is waiting indefinitely for the result.To avoid this the channel should be closed using the same approach as closing the channel on shutdown: applying first a graceful shutdown and then if necessary perform a forced shutdown after this grace period.
This also improves code reuse and reduces complexity in the GrpcClient.