-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set a channel's idle timeout #2046
Comments
Just to clarify, when I said "grpc-js does not currently support that functionality", I meant that grpc-js does not implement the idle timeout functionality at all. Currently, the only way for a channel to transition from READY to IDLE is if the connection drops. |
In addition, regarding this:
I would recommend not doing that, if possible. The channel state is primarily informational, and the gRPC API is intended to be used without ever checking the channel state. In particular, related to what I see in your linked issue, gRPC itself does not consider IDLE to be a terminal state; a gRPC channel can generally transparently reconnect after going IDLE. There may be a simpler way of doing what you are trying to accomplish without relying on channel state changes. In addition, related to some discourse I see in your issue, this IDLE timeout, if it was implemented, would be focused on application-level events. It is not related to TCP-level activity or connectivity, but rather about how long since there have been any active gRPC-level requests. The detection of TCP connection loss is handled separately. The keepalive parameters you mention control HTTP/2 pings that are sent to prevent servers and proxies from closing connections due to inactivity. By default they are only sent if a connection has had at least one open stream continuously for the specified amount of time, because their primary purpose is to keep connections open while they host long-running streams that may be intermittently idle. The channel option |
The channel IDLE timeout has been implemented in grpc-js 1.9.x. It defaults to 30 minutes and is controlled by the |
Is your feature request related to a problem? Please describe.
A gRPC channel has observable connection states:
CONNECTING
,READY
,TRANSIENT_FAILURE
,IDLE
, andSHUTDOWN
(as per https://grpc.github.io/grpc/core/md_doc_connectivity-semantics-and-api.html). Specifically, the channel's transition fromREADY
toIDLE
is governed by the "idle timeout" value of the channel. There's a couple of pieces of documentation from gRPC core that talk about this idle timeout parameter:We use these low-level transitions to perform specific logic on our domain's connections, and would like to test this specific transition from
READY
toIDLE
(but don't want a test that runs for 5 or 30 minutes).Describe the solution you'd like
We'd like a publicly-exposed means of adjusting the value of the channel's idle timeout (e.g. a
ChannelOptions
parameter when initialising the channel).Describe alternatives you've considered
We've taken a look in the
ClientOptions
andChannelOptions
in grpc-js, but have had no luck in finding anything that would resolve this problem.Although, there are the options of
keepalive_time_ms
andkeepalive_timeout_ms
. Would it be possible to use these to augment this functionality? Or any other further options that might be useful here?Additional context
READY
toIDLE
transition MatrixAI/Polykey#332The text was updated successfully, but these errors were encountered: