-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add timeout to connection.Connect() #131
Conversation
Welcome @ConnorJC3! |
Hi @ConnorJC3. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
@dims: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign msau42 xing-yang |
/ok-to-test |
@@ -70,7 +70,7 @@ func SetMaxGRPCLogLength(characterCount int) { | |||
// For other connections, the default behavior from gRPC is used and | |||
// loss of connection is not detected reliably. | |||
func Connect(address string, metricsManager metrics.CSIMetricsManager, options ...Option) (*grpc.ClientConn, error) { | |||
return connect(address, metricsManager, []grpc.DialOption{}, options) | |||
return connect(address, metricsManager, []grpc.DialOption{grpc.WithTimeout(time.Second * 30)}, options) |
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.
The comment should also be updated.
@ConnorJC3 Can you address the comments? We're going to cut a release soon. Thanks. |
@xing-yang sorry, I somehow missed the above review comment. New version of the PR uploaded with the comment changed. |
If connection.Connect() gets stuck it will block infinitely, never reporting an error to the library's consumer. We have received reports of this happening even when a _valid_ address is passed in node-driver-registrar because of a race condition involving pod restarts. Specifically, there is an unlucky sequence of events when restarting both the CSI Driver and node-driver-registrar, wheere the node-driver-registar will attempt to Connect() to the CSI Driver, but will get stuck doing so on an old file descriptor from the previously running CSI Driver (and thus, get stuck infinitely). There is no mechanism to pass a connection timeout to Connect, so this commit adds a reasonbly long default timeout so these cases will eventually return an error rather than getting stuck infinitely. Signed-off-by: Connor Catlett <conncatl@amazon.com>
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ConnorJC3, xing-yang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
If connection.Connect() gets stuck it will block infinitely, never reporting an error to the library's consumer.
We have received reports of this happening even when a valid address is passed in node-driver-registrar because of a race condition involving pod restarts. Specifically, there is an unlucky sequence of events when restarting both the CSI Driver and node-driver-registrar, wheere the node-driver-registar will attempt to Connect() to the CSI Driver, but will get stuck doing so on an old file descriptor from the previously running CSI Driver (and thus, get stuck infinitely).
There is no mechanism to pass a connection timeout to Connect, so this commit adds a reasonbly long default timeout so these cases will eventually return an error rather than getting stuck infinitely.
Does this PR introduce a user-facing change?: