aws-sdk-go icon indicating copy to clipboard operation
aws-sdk-go copied to clipboard

WaitUntilNetworkInterfaceAvailableWithContext does not block with InvalidNetworkInterfaceID.NotFound error

Open mzampetakis opened this issue 3 years ago • 2 comments

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug Invoking WaitUntilNetworkInterfaceAvailableWithContext with a non existing Network ID returns immediately with an error. The same happens in cases that Network is not available (e.g. right after the CreateNetworkInterface invocation). I would expect that WaitUntilNetworkInterfaceAvailableWithContext blocks for a period of time (10 attempts * 20" by default) until it fails with a ResourceNotReady error. Currently the error returned is InvalidNetworkInterfaceID.NotFound.

Version of AWS SDK for Go? 1.42.9

Version of Go (go version)? go version go1.17.3 darwin/amd64

To Reproduce (observed behavior)

someID := "eni-1234567890"
err = e.svc.WaitUntilNetworkInterfaceAvailableWithContext(aws.BackgroundContext(),
  &ec2.DescribeNetworkInterfacesInput{
	NetworkInterfaceIds: []*string{
		&someID,
	},
})
if err != nil {
  log.Error("Network interface ", someID, " did not become available after creation. Err: ", err)
  return nil, err
}

Expected behavior In the code presented above, I would expect having the WaitUntilNetworkInterfaceAvailableWithContext to block the execution for the whole period of the polling time (10 attempts * 20") as the Network is not found (as it has not even created). But instead of this, it immediately returns an error with type InvalidNetworkInterfaceID.NotFound.

Additional context The same issue affects the WaitUntilNetworkInterfaceAvailable which directly invokes the WaitUntilNetworkInterfaceAvailableWithContext. The possible solution to this is to remove the acceptor

{
  "expected": "InvalidNetworkInterfaceID.NotFound",
  "matcher": "error",
  "state": "failure"
}

from the WaitUntilNetworkInterfaceAvailableWithContext acceptors. I have prepared a branch with the required change but it requires changes to the models/apis/ec2/2016-11-15/waiters-2.json which, based on the guidelines requires to open an issue first instead of a PR.

mzampetakis avatar Feb 17 '22 19:02 mzampetakis

Hi, is this still persisting with the latest version of SDK?

vudh1 avatar Apr 29 '22 21:04 vudh1

Hi @vudh1 , the issue is still persisting with the latest version of the SDK. Currently it is at https://github.com/aws/aws-sdk-go/blob/main/service/ec2/waiters.go#L990 Release v1.44.4 (2022-04-29).

mzampetakis avatar Apr 30 '22 06:04 mzampetakis