-
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
client: reset backoff to 0 after a connection is established #2669
Conversation
@@ -1032,6 +1032,7 @@ func (ac *addrConn) resetTransport() { | |||
continue | |||
} | |||
|
|||
backoffFor = 0 |
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.
It works fine for us to reconnect immediately after connection closed.
But I think this also resets backoff duration when reconnecting failed repeated in the server down, which resulted in trying to reconnect aggressively.
So the backoff duration should be reset only in first retry like this?
if ac.backoffIdx == 0 {
backoffFor = 0
}
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.
If reconnecting failed, we will continue
above, and won't reach this.
This only happens when we successfully create a connection, and we want to skip any backoff if this connection breaks.
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.
sorry it's my bad. I tried again with this branch and it does retry to connect with backoff correctly.
If the connection fails to be created, this code will be skipped. Did you apply this patch to master@HEAD or another branch/commit? Are you setting |
@@ -1032,6 +1032,7 @@ func (ac *addrConn) resetTransport() { | |||
continue | |||
} | |||
|
|||
backoffFor = 0 |
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.
Actually, this should also reset ac.backoffIdx = 0
.
EDIT: Oh we already do this below; maybe we should move it up here though for consistency and to avoid taking the lock an extra time.
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.
I have cleanup changes in another branch, was trying to keep this change simple so we can cherrypick it to previous releases.
Looks like we've missed a few releases -- here they are. The interesting releases are: - v1.20.0, as it has a few new features and bug fixes - v1.19.1 has a bug fix for grpc/grpc-go#2669, which could have happened to us as well. For all the notes, see the releases page: https://github.com/grpc/grpc-go/releases Signed-off-by: Stephan Renatus <[email protected]>
Looks like we've missed a few releases -- here they are. The interesting releases are: - v1.20.0, as it has a few new features and bug fixes - v1.19.1 has a bug fix for grpc/grpc-go#2669, which could have happened to us as well. For all the notes, see the releases page: https://github.com/grpc/grpc-go/releases Signed-off-by: Stephan Renatus <[email protected]>
* deps: bump go-grpc (1.19.0 -> 1.20.1) Looks like we've missed a few releases -- here they are. The interesting releases are: - v1.20.0, as it has a few new features and bug fixes - v1.19.1 has a bug fix for grpc/grpc-go#2669, which could have happened to us as well. For all the notes, see the releases page: https://github.com/grpc/grpc-go/releases Signed-off-by: Stephan Renatus <[email protected]>
#2663
#2636