iann0036 / former2

Generate CloudFormation / Terraform / Troposphere templates from your existing AWS resources.
https://former2.com
MIT License
2.23k stars 268 forks source link

Endless "Too many requests" --> end infinity! #382

Closed dietmar-mueller closed 1 month ago

dietmar-mueller commented 1 month ago

I scan an aws account (with active debugging) and aws repeatedly sends “Too many requests” at the endpoint: CodeCommit.listRepositories

according to the code and logging, this has the expected consequence that a retry is made with a random multiplier for the delay.

so far so good. but this endpoint constantly responds with “too many requests” and the code is therefore stuck in an infinite loop.

is there a way to break this endless loop?

thanks for any advice

log:

1725433088215: sdkcall : IAM.listOpenIDConnectProviders - {} 1725433088231: sdkcall : FMS.listPolicies - {} 1725433088355: sdkcall : FMS.getNotificationChannel - {} ████████████████████████████████████████ 99% (147/148 services completed)Too many requests for CodeCommit.listRepositos1725433167648: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 775ms 1725433252892: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 1550ms 1725433339127: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 3100ms 1725433426971: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 6200ms 1725433517813: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 12400ms 1725433614724: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 24800ms 1725433724144: sdkcall : CodeCommit.listRepositories - {} 1725434041994: AWS::IAM::ServiceLinkedRoleitories, sleeping for 49600ms 1725434041995: aws_iam_service_linked_rolepositories - {} 1725434041995: AWS::IAM::ServiceLinkedRoleitories, sleeping for 99200ms 1725434041996: aws_iam_service_linked_rolepositories - {} 1725434041996: AWS::IAM::Role███████████ 100% (148/148 services completed) 1725434041996: aws_iam_role 1725434041996: AWS::IAM::User 1725434041996: aws_iam_user 1725434041997: AWS::IAM::Role 1725434041997: aws_iam_role 1725434041997: AWS::IAM::AccessKey 1725434041997: aws_iam_access_key Too many requests for CodeCommit.listRepositories, sleeping for 198400ms 1725434324948: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 396800ms 1725434806400: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 793600ms 1725435684942: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 1587200ms 1725437356582: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 3174400ms 1725440615294: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 6348800ms 1725447048639: sdkcall : CodeCommit.listRepositories - {} Too many requests for CodeCommit.listRepositories, sleeping for 12697600ms

dietmar-mueller commented 1 month ago

looked at the code again and only now saw the abort condition. but according to the log we would already be above the magic limit of: backoff > 120000

I'm not really familiar with js, but what I see is a check that changes data, but has no effect on the recursive call sdkcall.

if i drag this check a little further down over the sdkcall call, i see the behavior i expected in my test run

image

iann0036 commented 1 month ago

Hi @dietmar-mueller,

Thanks for raising this. I think this is actually the CodeCommit service misbehaving due to its deprecation.

As a result of that, I've commented out the code which deals with CodeCommit specifically (similar to the recent CodeStar update). If you're using the CLI, you may want to rebuild from source.

dietmar-mueller commented 1 month ago

hi @iann0036

i can confirm that commenting out the code for CodeCommit solves the problem of the hanging scan

thanks for your fast help.