Skip to content

With a lot of concurrent requests to metadata service, credentials can fail #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2015

Conversation

mick
Copy link
Contributor

@mick mick commented Dec 18, 2014

This is encountered as CredentialsError: Missing credentials in config because the request for IAM Role can timeout before all the requests are answered. fixes #445

The fix:

  • add a locking so the metadata service isnt flooded with requests.
  • add setImmediate so IO can still be processed even with a lot of request to the metadata service being generated.

This is a bit hard to add a test for. I did add a test for multiple concurrent requests to loadCredentials.

On an ec2 of the same type and size: This test case passed with these changes, even with increasing concurrency up to 10000.

cc: @lsegal @willwhite

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 2698bba on mick:creds_lock into 8a15f08 on aws:master.

…n fail.

To fix that:
 - add a lock so the metadata service isnt flooded with requests.
 - add process.nextTick so IO can still be processed even with a lot of request
   to the metadata service being generated + will work in browser with browserify.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 0c70713 on mick:creds_lock into b768e76 on aws:master.

mick referenced this pull request in mick/aws-sdk-js Jan 6, 2015
…n fail.

To fix that:
 - add a lock so the metadata service isnt flooded with requests.
 - add setImmediate so IO can still be processed even with a lot of request
   to the metadata service being generated.
@mick
Copy link
Contributor Author

mick commented Jan 7, 2015

@lsegal I think this is all set to go, unless there is anything else you think is blocking. Thanks! :octocat:

lsegal added a commit that referenced this pull request Jan 7, 2015
Add lock around AWS.MetadataService.loadCredentials()
@lsegal lsegal merged commit 3d6bbe7 into aws:master Jan 7, 2015
@lsegal
Copy link
Contributor

lsegal commented Jan 7, 2015

Looks good, thanks!

@mick
Copy link
Contributor Author

mick commented Jan 8, 2015

@lsegal great! Just curious, what does the release / publish cycle for aws-sdk look like? I'd like to be able to use this from npm.

@mick mick deleted the creds_lock branch January 8, 2015 00:10
@lsegal
Copy link
Contributor

lsegal commented Jan 8, 2015

We have a release scheduled this week. FWIW you can use this from npm already if you npm install git://github.com/aws/aws-sdk-js.

AdityaManohar added a commit that referenced this pull request Jan 8, 2015
@paritosh16
Copy link

I have a number of node modules that are running as cron jobs. The modules use the aws-sdk for javascript (Installed using npm install aws-sdk, current version being 2.1.38). It is giving the following error randomly,

{ [TimeoutError: Missing credentials in config]
  message: 'Missing credentials in config',
  code: 'CredentialsError',
  time: Mon Jul 13 2015 09:20:02 GMT+0000 (UTC),
  originalError:
   { message: 'Could not load credentials from any providers',
     code: 'CredentialsError',
     time: Mon Jul 13 2015 09:20:02 GMT+0000 (UTC),
     originalError:
      { message: 'Connection timed out after 1000ms',
        code: 'TimeoutError',
        time: Mon Jul 13 2015 09:20:02 GMT+0000 (UTC) } } }

This occurs randomly for all the modules. After the error, it again works fine for some time with another occurence of the error. Please help.

@lock
Copy link

lock bot commented Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CredentialsError: Missing credentials in config
4 participants