Skip to content

Retry configuration is ignored after call to get_available_regions() #1698

Closed
@nielslaukens

Description

I'm having trouble to use a non-default retry-configuration. After some debugging, I've encountered some unexpected behaviour that I consider a bug.

Code to reproduce the issue:

import botocore.session
from botocore.config import Config

# Any valid Elastic Beanstalk Environment ARN to query
arn = "TODO: FILL IN"


botocore_session = botocore.session.get_session()

# When this call is made, retry-config is ignored...
_ = botocore_session.get_available_regions('elasticbeanstalk')

client = botocore_session.create_client(
    'elasticbeanstalk',
    region_name="eu-west-1",
    config=Config(retries={'max_attempts': 2}),
)

while True:
    res = client.list_tags_for_resource(
        ResourceArn=arn,
    )
    if res['ResponseMetadata']['RetryAttempts'] > 2:
        print(res)
        break

The code needs to run with valid credentials configured (I used environment variables for my tests, but I don't thing it matters). Also, you need to fill in a valid ARN of an Elastic Beanstalk Environment to query. (I think the bug is not related to Beanstalk, but that is what I've used to debug the issue on).

The expected behaviour is for this code to hammer the API, and hit the Throttle limit. The list_tags_for_resource() call will then raise a ClientError explaining the issue.

The actual behaviour is that this code enters the final if, and prints out a successfull response that was retried more than 2 times, while the config is set to try at most 2 times.

Commenting out the get_available_regions() call, yields the expected behaviour. So it seams that this call changes some internal state of the session that causes later issues.

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a confirmed bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions