Skip to content
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

[infra] async'ify Credentials class #619

Closed
thehesiod opened this issue Aug 2, 2018 · 6 comments · Fixed by #659
Closed

[infra] async'ify Credentials class #619

thehesiod opened this issue Aug 2, 2018 · 6 comments · Fixed by #659
Labels
help wanted Extra attention is needed

Comments

@thehesiod
Copy link
Collaborator

thehesiod commented Aug 2, 2018

There are at least a couple underlying issues related to this class:

  1. IAM credential refresh using requests: Blocking call when loading credentials in Session.create_client #2
  2. AssumeRoleProvider uses client call: get_credentials() fails on AioSession #553 + AWS_PROFILE: TypeError: can't pickle coroutine objects #663

First one results in possible hangs of the main thread, while second one is broken because it's not await'ing the request of the client request.

The issue is that these are low-level in classes used by the Credential helper, and ultimately triggered by high level properties like secret_key, access_key and token. We need to find all the calls that will end up needing to be changed to async, and then figure a strategy of how to battle this. I'm afraid this is going to touch a LOT of botocore and greatly increase our footprint and amount of maintenance required.

@mjmdavis
Copy link

Is there a workaround for this at the moment?

@mannickutd
Copy link

@mjmdavis the work around I used was to use a synchronous botocore call using the refresh method defined in https://www.pydoc.io/pypi/botocore-1.7.0/autoapi/credentials/index.html#credentials.RefreshableCredentials and update credentials in the aiosession for the async clients.

@thehesiod thehesiod added the help wanted Extra attention is needed label Sep 5, 2018
@sbrandtb
Copy link

@mannickutd Could you elaborate and maybe provide a code snippet?

@thehesiod thehesiod changed the title async'ify Credentials class [infra] async'ify Credentials class Jan 21, 2019
@thehesiod
Copy link
Collaborator Author

prefixing with infra as my experiment yielded a LOT of changes

@thehesiod
Copy link
Collaborator Author

btw my PR needs to be re-done to be cleaner by delaying client creation to the __aenter__ so we don't have an extra await.

@thehesiod
Copy link
Collaborator Author

just got permission to expose what our company has been using to resolve this issue internally: https://gist.github.com/thehesiod/05298c1c89c7b5a38da0abc4ccbed7b7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants