-
Notifications
You must be signed in to change notification settings - Fork 638
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
feature/ec2/imds: Fix Client's response handling and operation timeout race #1448
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "17ac8941-9cd9-4e59-8fcc-93444709cc1a", | ||
"type": "feature", | ||
"description": "Respect passed in Context Deadline/Timeout. Updates the IMDS Client operations to not override the passed in Context's Deadline or Timeout options. If an Client operation is called with a Context with a Deadline or Timeout, the client will no longer override it with the client's default timeout.", | ||
"modules": [ | ||
"feature/ec2/imds" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "53dad1d6-8586-4ddf-b030-4829c2a45e4c", | ||
"type": "bugfix", | ||
"description": "Fix IMDS client's response handling and operation timeout race. Fixes #1253", | ||
"modules": [ | ||
"feature/ec2/imds" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
// Package imds provides the API client for interacting with the Amazon EC2 | ||
// Instance Metadata Service. | ||
// | ||
// All Client operation calls have a default timeout. If the operation is not | ||
// completed before this timeout expires, the operation will be canceled. This | ||
// timeout can be overridden by providing Context with a timeout or deadline | ||
// with calling the client's operations. | ||
// | ||
// See the EC2 IMDS user guide for more information on using the API. | ||
// https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html | ||
package imds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
maybe this could use the constant
defaultOperationTimeout
directly and remove thetimeout
var entirely fromoperationTimeout
struct? Seemsm.DefaultTimeout
will always bedefaultOperationTimeout
in the end.Not sure though of the impact/necessity on tests
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.
Having the
DefaultTimeout
member onoperationTimeout
middleware is handy if we want to change the timeout depending on the operation. I'm not aware of a need for this at the moment. SinceoperationTimeout
is not exported, having the member is preferred so we can reuse the operationTimeout middleware later.There is a test that uses a custom timeout, but I think this test needs to be tweaked a little bit to more closely align with the intention behind it. e.g. if there was a context with timeout use it, if there wasn't use a default. This test is relying on the behavior of a canceled context, and the configured nanosecond timeout input.
aws-sdk-go-v2/feature/ec2/imds/request_middleware_test.go
Lines 128 to 152 in dccd10a
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.
Updated
operationTimeout
to not set a default timeout, ifDefaultTimeout
is zero. I think this was the missing behavior in keepingDefaultTimeout
member inoperationTimeout
.