Skip to content
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

Merged
merged 5 commits into from Mar 31, 2017

Conversation

MakMukhi
Copy link
Contributor

No description provided.

}
case <-timeout.C:
t.Fatalf("Test failed: Expected a GoAway from server.")
}
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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) {
Copy link
Member

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?).

}
clientOptions := ConnectOptions{
KeepaliveParams: keepalive.ClientParameters{
Time: 100 * time.Millisecond,
Copy link
Member

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?

}
clientOptions := ConnectOptions{
KeepaliveParams: keepalive.ClientParameters{
Time: 100 * time.Millisecond,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same concern.


// Give keepalive enough time.
time.Sleep(2 * time.Second)
// Asser that connection is healthy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsserT


// Give keepalive enough time.
time.Sleep(2 * time.Second)
// Asser that connection is healthy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsserT


// 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 {
Copy link
Member

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.

// 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
Copy link
Member

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?

@MakMukhi MakMukhi merged commit b2fae0c into grpc:master Mar 31, 2017
@menghanl menghanl added 1.3 Type: Feature New features or improvements in behavior labels Apr 18, 2017
bdarnell added a commit to bdarnell/cockroach that referenced this pull request Aug 16, 2017
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
bdarnell added a commit to bdarnell/cockroach that referenced this pull request Aug 16, 2017
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
bdarnell added a commit to bdarnell/cockroach that referenced this pull request Aug 17, 2017
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
@MakMukhi MakMukhi deleted the keepalive_restrictions branch May 4, 2018 02:06
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants