Skip to content

RefreshingAWSCredentials using global lock + slow AssumeRoleWithWebIdentityCredentials #2464

Closed
@denis-nikolayev-warby

Description

@denis-nikolayev-warby

Describe the bug

Encountered interesting issue with GetCredentialsAsync() + "slow" AssumeRoleWithWebIdentityCredentials + tight timeout on calls to our app.

https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Core/Amazon.Runtime/Credentials/RefreshingAWSCredentials.cs#L146
image

  1. it acquires global lock
  2. check if token is expired
  3. makes a slow network call to CredentialsFromAssumeRoleWithWebIdentityAuthenticationAsync
  4. release lock

Unfortunately don't have statistics from aws .net sdk, but have from aws nodejs sdk. Assume this slow call is about the same
image

we tried to implement simple wrapper
image

that works pretty well, because number of timeout errors goes down after deploying this fix (24th)
image

Expected Behavior

background refreshing token

Current Behavior

global lock

Reproduction Steps

do not apply

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK.Core 3.7.8.2

Targeted .NET Platform

.NET 6.0

Operating System and version

aws eks, docker, Debian 11, mcr.microsoft.com/dotnet/aspnet:6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.credentialsp2This is a standard priority issuequeued

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions