-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
Fix the client-side ping policy #11587
Conversation
|
|
Jenkins: test this please |
|
|
|
|
|
|
@@ -2398,6 +2418,36 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args *args, | |||
&args->args[i], | |||
(grpc_integer_options){g_default_keepalive_permit_without_calls, | |||
0, 1}); | |||
} else if (0 == | |||
strcmp(args->args[i].key, GRPC_ARG_HTTP2_MAX_PING_STRIKES)) { | |||
g_default_max_ping_strikes = grpc_channel_arg_get_integer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting global state from transport construction is the wrong thing to do:
- it's not thread safe (what if I create transports from two threads)
- it's order dependent (max_ping_strikes now depends on the construction order of transports, which might change even due to network latency - meaning this could become a random number)
Better would be to hold these values as properties of the transport (preferably as some sub-struct... grpc_chttp2_ping_enforcement_args?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
These global values are not set from transport construction, they are set in grpc_chttp2_config_default_keepalive_args()
. It's an internal interface, and must only be called at the initialization stage, as stated here.
The transport struct has corresponding properties in grpc_chttp2_repeated_ping_policy
. When constructing a transport, we will use g_default_max_ping_strikes
as the default value of grpc_chttp2_transport.ping_policy.max_ping_strikes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does initialization stage mean?
- before grpc_init?
- after grpc_init?
- before transport construction?
If it's an internal interface, who is supposed to call it? (no code can, because it's internal)
What is the justification for introducing yet another configuration mechanism?
Needs conflict resolution |
Resolved conflict. Please see the email thread for the explanation of |
|
|
|
|
Please let me know once merged. |
Known failures: |
Bad news: This isn't actually fixing the problem I was seeing with #11072 |
chttp2_transport was too strict about sending ping. It may prevent legal keepalive pings from being sent. This PR relaxes the restriction as described in Client-side Keepalive: