Closed pedrohdz closed 6 years ago
Here's another example I just ran into. When trying to create a subnet, it seems like _create_resource()
in salt/modules/boto_vpc.py
tries to assign a name to the new resource, a subnet in this cace. A race condition is causing the following error:
[INFO ] Running state [DEMO-SALTSTACK-VPC-subnet0] at time 09:34:40.905079
[INFO ] Executing state boto_vpc.subnet_present for DEMO-SALTSTACK-VPC-subnet0
[INFO ] Subnet DEMO-SALTSTACK-VPC-subnet0 does not exist.
[INFO ] Matching VPC: vpc-5957b13e
[INFO ] A subnet with id subnet-5628b60e was created
[ERROR ] Failed to create subnet: Bad Request: The subnet ID 'subnet-5628b60e' does not exist
[INFO ] Completed state [DEMO-SALTSTACK-VPC-subnet0] at time 09:34:41.821020 duration_in_ms=915.941
local:
Name: DEMO-SALTSTACK-MASTER - Function: boto_iam_role.present - Result: Changed Started: - 09:34:32.656596 Duration: 3532.166 ms
Name: DEMO-PUBLIC_KEY - Function: boto_ec2.key_present - Result: Changed Started: - 09:34:36.194447 Duration: 1005.775 ms
Name: DEMO-SALTSTACK-VPC - Function: boto_vpc.present - Result: Changed Started: - 09:34:37.203591 Duration: 1639.402 ms
Name: DEMO-SALTSTACK-VPC - Function: boto_vpc.internet_gateway_present - Result: Changed Started: - 09:34:38.843ion: 1023.9 ms
Name: DEMO-SALTSTACK-VPC - Function: boto_vpc.dhcp_options_present - Result: Changed Started: - 09:34:39.867404 Duration: 1037.417 ms
----------
ID: Subnet subnet0 exists
Function: boto_vpc.subnet_present
Name: DEMO-SALTSTACK-VPC-subnet0
Result: False
Comment: Failed to create subnet: Bad Request: The subnet ID 'subnet-5628b60e' does not exist
Started: 09:34:40.905079
Duration: 915.941 ms
Changes:
Summary for local
------------
Succeeded: 5 (changed=5)
Failed: 1
------------
Total states run: 6
Total run time: 9.155 s
I look in the AWS console and see that the subnet was created, but it was not assigned the name. My guess is that either _maybe_set_name_tag()
or _maybe_set_tags()
failed due to a race condition.
I have not been able to reproduce this one.
Okay so we need to make sure we narrow down this issue so we know when it can be closed. From what I can see in this issue so far you are running into race conditions for the following:
Just to clarify all of these situations above do not happen consistently correct?
The first two items can be reproduced on a fairly regular basis, assuming the calls happen in immediate succession.
The third, and final, happens very irregularly.
thanks for the clarification. We will need to get this fixed up. Thanks
Thank you!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Description of Issue/Question
I am running into all sorts of race conditions while implementing a formula utilizing the
boto_*
states. I looked through the code and only found one instance ofget_waiter()
being called, it's insalt/modules/boto_s3_bucket.py
.Maybe I'm missing something here? :-)
Here's an example. Unable to delete subnet after terminating an EC2 instance.
demo00.local
is insubnet0
, and the only server in that subnet. The following:Will yield something like:
It seems that SaltStack tries to delete the subnet before the instance has been terminated. A
get_wait()
might be useful here. Maybe make it an option?I have been seeing all sorts of timing related inconsistencies when trying to use SaltStack
boto_*
states for managing AWS. Another example is trying to create an EC2 instance immediately after creating a IAM Role for it.boto_iam_role.present
returns immediately, but theboto_ec2.instance_present
starts before the IAM role is actually created. This gives the following error:Given that these are timing related it can be hit or miss.
Now I am able to work around this by waiting a minute or two then rerunning the command. I even hack dependency orders. It works, but seems like using
get_waiter()
and waiting on AWS events to complete would be cleaner.Setup
Please review above...
Steps to Reproduce Issue
Please review above...
Versions Report
All versions as far as I can tell.