question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Waiter encountered a terminal failure state

See original GitHub issue

When calling wait_until_running() on an instance, sometimes I receive this exception:

2015-07-13 11:44:42,583 INFO call Calling ec2:wait_until_running with {‘InstanceIds’: [‘i-972ed75e’]} 2015-07-13 11:45:43,687 ERROR decorated_function Waiter InstanceRunning failed: Waiter encountered a terminal failure state Traceback (most recent call last): … File “…/lib/python3.4/site-packages/boto3/resources/factory.py”, line 227, in #do_waiter waiter(self, _args, *_kwargs) File “…/lib/python3.4/site-packages/boto3/resources/action.py”, line 194, in #call response = waiter.wait(**params) File “…/lib/python3.4/site-packages/botocore/waiter.py”, line 284, in wait reason=‘Waiter encountered a terminal failure state’) botocore.exceptions.WaiterError: Waiter InstanceRunning failed: Waiter encountered a terminal failure state

In the console, the instance does come into the running state. I have turned on boto3 debug logging but haven’t recreated it again since this happened.

OS X Yosemite 10.10.3 Python 3.4.2 boto3 1.1.0

Edit: I extracted the methods in our custom code to a script that will (hopefully) recreate the issue.

import logging, boto3, time

boto3.set_stream_logger('boto3', logging.DEBUG)
ec2 = boto3.resource('ec2', region_name='us-east-1')
instance = ec2.create_instances(
    ImageId='ami-b0210ed8',
    InstanceType='t2.micro',
    MinCount=1,
    MaxCount=1,
)[0]
print('Created instance:', instance.id)
instance.wait_until_running()
time.sleep(5)
instance.terminate()
instance.wait_until_terminated()
print('Terminated instance:', instance.id)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:24 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
rirzecommented, Apr 9, 2020

After looking around, I’ve ended up using the waiters directly. Specifically, where ever I’d want to use:

Instance.wait_until_stopped()

I now use:

stopped_instance_waiter = ec2_client.get_waiter('instance_stopped')
stopped_instance_waiter.wait(InstancesIds=[Instance.id])

Yes, it’s an annoying amount of boilerplate, but it doesn’t produce the error above. Maybe the way boto3 implemented the resource level method causes occasional errors.

3reactions
shawnpgcommented, Feb 7, 2017

I was hitting this issue and observed the same thing @turtlemonvh saw:

State transition reason Client.VolumeLimitExceeded: Volume limit exceeded

Deleting some unnecessary volumes cleared things up.

It would be great if the Waiter exception could provide something a little more informative. Even if it can’t detect whether a failure was because of a volume limit issue at runtime, a different string that recommends looking at the metadata for the failed instance would have pointed me in the right direction without as much internet searching.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Waiter encountered a terminal failure state - Stack Overflow
In my case cfn linter was ok with yaml, error (used aws CLI from cmd) was just. Waiter ChangeSetCreateComplete failed: Waiter encountered a ......
Read more >
Waiter encountered a terminal failure state: For expression ...
Error: Failed to create managed resources: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression "Stacks[].
Read more >
Waiter DeploymentSuccessful failed - Atlassian Community
Waiter DeploymentSuccessful failed: Waiter encountered a terminal failure state ... I am getting this error when deploying code to AWS EC2 ...
Read more >
aws/aws-cli - Gitter
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED.
Read more >
Lambda deployment error - Google Groups
Error: Failed to create managed resources: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state: For expression ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found