[BUG] AWS check for instances after creation can sometimes be too fast.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
sometimes the creation of aws instances can happen too fast to be located with a describeinstances call which happens within the create function. and aws will return an error that is not part of the retry check. causing the instances to exist but salt failing to work with it. as the describeinstance check will fail, causing the create function to bail at that point.
unfortunately, this issue is intermittent and depends on a master being faster to respond than aws so difficult to test.
Setup
use aws to create an instance using a master with a low response time to aws.
Steps to Reproduce the behavior
with a master with a low response time to aws run a create instance with trace logging. You should see something like the below if it does work too quickly.
[DEBUG ] The new VM instance_id is i-insertidhere
[DEBUG ] Using AWS endpoint: ec2.us-west-2.amazonaws.com
[DEBUG ] AWS Request: https://ec2.us-west-2.amazonaws.com/?Action=DescribeInstances&InstanceId.1=i-insertidhere&Version=2014-10-01
[TRACE ] AWS Request Parameters: {}
[DEBUG ] AWS Response Status Code: 400
[TRACE ] AWS Response Text: <?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>InvalidInstanceID.NotFound</Code><Message>The instance ID 'i-insertidhere' does not exist</Message></Error></Errors><RequestID>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</RequestID></Response>
Expected behavior
describeinstance check is retried when aws returns with a 400 for invaliinstanceID
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3001.4
Dependency Versions:
cffi: Not Installed
cherrypy: 3.5.0
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
Jinja2: 2.8
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.4.7
pygit2: Not Installed
Python: 3.5.2 (default, Oct 7 2020, 17:19:02)
python-gnupg: 0.3.8
PyYAML: 3.11
PyZMQ: 17.1.2
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: ubuntu 16.04 Xenial Xerus
locale: UTF-8
machine: x86_64
release: 4.4.0-1113-aws
system: Linux
version: Ubuntu 16.04 Xenial Xerus
Additional context
This looks like a rehash of https://github.com/saltstack/salt/issues/16675 which was originally solved by adding a delay.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Salt's AWS instance creation flow and the describeinstances request shown in the trace, then inspect how AWS 400 responses are classified for retry. Reproduce with trace logging if possible; done means an InvalidInstanceID.NotFound response after creation is retried rather than causing the create operation to fail.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100