-
Notifications
You must be signed in to change notification settings - Fork 840
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
MediaLive waitUntilInputDeleted does not work. #5125
Comments
@cobar79 to clarify, your ask is for the waiter Let me know if I'm missing something. |
@debora-ito |
Ok, so I think what's missing here is a waiter for Input Security Group. 'waitUntilInputDelete' seems to be working as expected, its success condition is DELETED, not DETACHED, so the waiter will keep calling DescribeInput while the status is different than DELETED, and time out in this case. According to the possible values of InputState, after calling DeleteInput it can move from DETACHED to DELETING (even very briefly) then to DELETED. That's why this waiter exists, the input can be on DELETING state for a while. As you noticed, there's no waiters for Input Security Groups, so as a workaround you can poll it manually - here's a very simplistic example: int attemptNumber = 0;
//manually polling InputSecurityGroup
while (attemptNumber < 20) {
DescribeInputSecurityGroupResponse describeResponse =
mediaLiveClient.describeInputSecurityGroup(s-> s.inputSecurityGroupId(INPUT_SECGROUP_ID));
if (describeResponse.state().equals(InputSecurityGroupState.IDLE)) {
break;
}
Thread.sleep(500);
attemptNumber++;
}
mediaLiveClient.deleteInputSecurityGroup(d->d.inputSecurityGroupId(INPUT_SECGROUP_ID)); In the meantime, I'll reach out to the MediaLive team and ask them to add waiters for Input Security Groups to the model. Let us know if this helps. |
Agree that there should be a waiter on Input Security Group. I still believe the Input Waiter is broken since I always get
I didn't attempt to override the backoff strategy. Will try the workaround but |
I implemented the manual wait on the input security group. However, it is won't be reached or work since the input delete fails maxAttempts. This should not be failing since the input is already Detached? It takes very little time to delete it in the console. In fact I bumped the waitTimeout to 3 minutes, jumped in the console and manually deleted the input and the waiter finished and deleted the input security group via the SDK.
|
To confirm I understand the steps you are taking: (1) Input is in DETACHED state ? |
(1) Correct, it is already in detached state since the channel failed to be created. Therefore the waitTillInputDetached occurs for once iteration. (2) I do not call deleteInput directly, I use the waiter. (3) Call ml.waitUntilInputDeleted. Fails unless I do it manually in console. You can run it if you change test properties
|
You need to call the MediaLive DeleteInput API. The waiter won't change the state of the input the way you're expecting. All the waiter does is wait. The waiter is not a substitute for the API call that will change the input state from detached to deleted. When you call an API, it may take some time for the change to be reflected in the resource on the server side. Sometimes you need the resource to be on a specific state before moving on in your code. For example: if you make a DynamoDB CreateTable call and immediately after you start adding items to the table, you'll probably see an error saying the table doesn't exist. To help with this, you can use waiters that will block the code and keep checking if the resource is in the desired state, and unblock when the desired state is reached. Using the DynamoDB example, you can call CreateTable and use the waiter In your code, you need to make a DeleteInput request before using the waiter
Regarding the lack of waiters for Input Security Group, I reached out to the MediaLive service team but haven't heard back yet. |
@debora-ito bad assumption on my part. I had to additionally add a check for detached state since the input delete skipped the detach state.
|
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
When using MediaLive waitUntilInputDeleted when the input is in a "Detached" state, the input is not deleted and the request times out.
When directly deleting the mediaLiveClient.deleteInput(DeleteInputRequest.builder().inputId(inputId).build()); the input is deleted.
However, this makes the deletion of the Input Security Group fail because it is not Idle.
I did search for MediaLiveWaiter waitUntilInputSecurityGroupIdle but it does not seem to exist.
Expected Behavior
The MediaLive input should be immediately deleted since it is in a Detached state and not time out. This would insure that the Security Group is Idle and able to be deleted.
Current Behavior
software.amazon.awssdk.core.exception.SdkClientException: The waiter has exceeded the max retry attempts: 21
Subsequently, you have to enter the console and delete the detached Input, wait a few seconds and delete the Security group once it is Idle.
Reproduction Steps
See
Run MediaLiveServiceTests whenCreateChannel_givenChannelRequest_thenCreateChannel
Failure occurs because it is unclear where to set the Archive S3 URL in the SDK.
Archive group destination A
Enter a destination for archiving your first group.
URL s3://<bucket>/<folder>/<file-prefix>
Video Service App GitHub
Possible Solution
Fix waitUntilInputDeleted to delete the Detached Input
Add waitUntilInputSecurityGroupIdle functionallity
Additional Information/Context
No response
AWS Java SDK version used
2.25.14
JDK version used
Corretto-17.0.7.7.1 (build 17.0.7+7-LTS)
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: