stacker icon indicating copy to clipboard operation
stacker copied to clipboard

Handle S3 eventual consistency better?

Open ejholmes opened this issue 8 years ago • 0 comments

Every once in a while, I get an error like this:

Traceback (most recent call last):
  File "/usr/local/bin/stacker", line 4, in <module>
    __import__('pkg_resources').run_script('stacker==1.0.3', 'stacker')
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 748, in run_script
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1524, in run_script
  File "/usr/local/lib/python2.7/site-packages/stacker-1.0.3-py2.7.egg/EGG-INFO/scripts/stacker", line 9, in <module>

  File "build/bdist.linux-x86_64/egg/stacker/commands/stacker/build.py", line 52, in run
  File "build/bdist.linux-x86_64/egg/stacker/actions/base.py", line 127, in execute
  File "build/bdist.linux-x86_64/egg/stacker/actions/build.py", line 304, in run
  File "build/bdist.linux-x86_64/egg/stacker/plan.py", line 267, in execute
  File "build/bdist.linux-x86_64/egg/stacker/plan.py", line 227, in _single_run
  File "build/bdist.linux-x86_64/egg/stacker/plan.py", line 74, in run
  File "build/bdist.linux-x86_64/egg/stacker/actions/build.py", line 252, in _launch_stack
  File "build/bdist.linux-x86_64/egg/stacker/providers/aws/default.py", line 233, in update_stack
  File "build/bdist.linux-x86_64/egg/stacker/providers/aws/default.py", line 71, in retry_on_throttling
  File "build/bdist.linux-x86_64/egg/stacker/util.py", line 61, in retry_with_backoff
  File "/usr/local/lib/python2.7/site-packages/botocore-1.7.17-py2.7.egg/botocore/client.py", line 312, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore-1.7.17-py2.7.egg/botocore/client.py", line 601, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the UpdateStack operation: Template file referenced by https://s3.amazonaws.com/<bucket>/<stack>-0480ad10.json does not exist.

From http://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html:

Amazon S3 provides read-after-write consistency for PUTS of new objects in your S3 bucket in all regions with one caveat. The caveat is that if you make a HEAD or GET request to the key name (to find if the object exists) before creating the object, Amazon S3 provides eventual consistency for read-after-write.

So, if I'm understanding that correctly, because a do a head_object before uploading the template, it's making that key eventually consistent?

ejholmes avatar Oct 11 '17 02:10 ejholmes