Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Ping Frame / Keep alive #1

Closed
SProst opened this issue Jun 1, 2019 · 6 comments
Closed

Ping Frame / Keep alive #1

SProst opened this issue Jun 1, 2019 · 6 comments

Comments

@SProst
Copy link

SProst commented Jun 1, 2019

The default timeout for the http2 session is 2 minutes. Should a setInterval for pinging be established in the call class based on the defaults specified here for the server? https://github.com/grpc/grpc/blob/56006f0c532fd98a2b327852c763778279616e01/doc/keepalive.md

Per the guidance linked above, if you configure the client to send ping frames the server should receive the ping frame and respond. In addition, it might be useful to implement this: GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS.

@cjihrig
Copy link
Owner

cjihrig commented Jun 2, 2019

Yes, I think the server should implement keepalive pings. I think the best place to start is with support for:

  • grpc.keepalive_time_ms, with a default value of 7200000 (2 hours).
  • grpc.keepalive_timeout_ms, with a default value of 20000 (20 seconds).

@SProst
Copy link
Author

SProst commented Jun 2, 2019

@cjihrig There is one other number to be aware of potentially. I originally stumbled across this because I have a C# client and the channel setting GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS defaults on the client to 5 minutes, which is 3 minutes longer than the default http2 server timeout. A long running process might not return a value in 2 minutes, which would cause the server to send a GOAWAY. Of course the client won't even attempt to check if the server is still up until 5 minutes have passed. Would it make sense to set the default timeout for the http2 server at some multiple of the GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS ?

@cjihrig
Copy link
Owner

cjihrig commented Jun 2, 2019

Would it make sense to set the default timeout for the http2 server at some multiple of the GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS ?

I think the answer might be to disable session timeouts if possible. If that's not possible, maybe it could be set to the highest possible value. By default, gRPC requests are supposed to have an infinite deadline, so Node probably shouldn't be closing the connection on its own at any point.

@SProst
Copy link
Author

SProst commented Jun 2, 2019

@cjihrig I was able to disable the timeout by setting it to 0, and have the callback be a noop.

@cjihrig
Copy link
Owner

cjihrig commented Jun 4, 2019

The first step of this, disabling the timeout, is now implemented in 1eaf0cf. Additionally, this behavior has been disabled in Node's master branch in nodejs/node#27558.

@cjihrig cjihrig closed this as completed in e13772d Jun 5, 2019
@cjihrig
Copy link
Owner

cjihrig commented Jun 5, 2019

This has been published in version 0.1.4. Again, thanks for the issues and feature requests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants