-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Implementation for server enforcement of keepalive policy. #1147
Conversation
} | ||
case <-timeout.C: | ||
t.Fatalf("Test failed: Expected a GoAway from server.") | ||
} |
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.
Also check for connection closed.
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.
Done.
transport/http2_server.go
Outdated
if ns < 1 && !t.kep.PermitWithoutStream { | ||
// Keepalive shouldn't be active thus, this new ping should | ||
// have come after atleast two hours. | ||
if t.lastPingAt.Add(2 * time.Hour).After(now) { |
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.
This 2*time.Hour should probably be a constant (next to maxPingStrikes?).
transport/transport_test.go
Outdated
} | ||
clientOptions := ConnectOptions{ | ||
KeepaliveParams: keepalive.ClientParameters{ | ||
Time: 100 * time.Millisecond, |
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.
Should this be 101ms (or more) to avoid a race between the timers?
transport/transport_test.go
Outdated
} | ||
clientOptions := ConnectOptions{ | ||
KeepaliveParams: keepalive.ClientParameters{ | ||
Time: 100 * time.Millisecond, |
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.
Same concern.
transport/transport_test.go
Outdated
|
||
// Give keepalive enough time. | ||
time.Sleep(2 * time.Second) | ||
// Asser that connection is healthy |
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.
AsserT
transport/transport_test.go
Outdated
|
||
// Give keepalive enough time. | ||
time.Sleep(2 * time.Second) | ||
// Asser that connection is healthy |
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.
AsserT
keepalive/keepalive.go
Outdated
|
||
// EnforcementPolicy is used to set keepalive enforcement policy on the server-side. | ||
// Server will close connection with a client that violates this policy. | ||
type EnforcementPolicy struct { |
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.
Should we have some notes in the ClientParameters to the effect of "make sure you set these parameters in coordination with the service owners, as incompatible settings can result in RPC failures"?
Especially since there's a default enforcement policy of 5m and no pings without streams, even if the service doesn't declare a policy.
keepalive/keepalive.go
Outdated
// Server will close connection with a client that violates this policy. | ||
type EnforcementPolicy struct { | ||
// MinTime is the minimum amount of time a client should wait before sending a keepalive ping. | ||
MinTime time.Duration |
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.
Would you mind documenting the default values for all of the settings in this file?
This error code is used for fail-fast errors (which can be retried unambiguously), but it is also used in other cases (such as a server draining) in which we cannot assume that the previous attempt was not completed. (It's unclear whether this assumption was once true and changed or if it's always been incorrect. The specific source of ambiguous Unavailable errors we're seeing is grpc/grpc-go#1147) This is expected to increase prevalence of AmbiguousResultErrors; this will be fixed in a follow-up change. Fixes cockroachdb#17491
This error code is used for fail-fast errors (which can be retried unambiguously), but it is also used in other cases (such as a server draining) in which we cannot assume that the previous attempt was not completed. (It's unclear whether this assumption was once true and changed or if it's always been incorrect. The specific source of ambiguous Unavailable errors we're seeing is grpc/grpc-go#1147) This is expected to increase prevalence of AmbiguousResultErrors; this will be fixed in a follow-up change. Fixes cockroachdb#17491
This error code is used for fail-fast errors (which can be retried unambiguously), but it is also used in other cases (such as a server draining) in which we cannot assume that the previous attempt was not completed. (It's unclear whether this assumption was once true and changed or if it's always been incorrect. The specific source of ambiguous Unavailable errors we're seeing is grpc/grpc-go#1147) This is expected to increase prevalence of AmbiguousResultErrors; this will be fixed in a follow-up change. Fixes cockroachdb#17491
No description provided.