Skip to content

Fix concurrent profile credentials initialization - #7435

Open
arnabnandy7 wants to merge 1 commit into
aws:masterfrom
arnabnandy7:fix/profileCredentialsRace
Open

arnabnandy7 wants to merge 1 commit into
aws:masterfrom
arnabnandy7:fix/profileCredentialsRace

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Motivation and Context

Concurrent initial calls to ProfileCredentialsProvider.resolveCredentials() could invoke the shared profile-file supplier before the credentials-provider initialization lock was acquired. This could expose partially initialized profile state and cause credential resolution to fail.

Fixes #6827

Modifications

  • Serialized the initial profile-file load and credentials-provider creation using the existing initialization lock.
  • Preserved the existing refresh behavior after initialization.
  • Added a concurrency regression test verifying that parallel initial calls do not load the profile file concurrently.
  • Added a next-release bugfix changelog entry.

Testing

Ran the targeted authentication module test:

.\mvnw.cmd -pl :auth "-Dtest=ProfileCredentialsProviderTest" test

Results:

  • 21 tests passed
  • 0 failures
  • 0 errors
  • Checkstyle passed with 0 violations
  • SpotBugs passed with 0 findings
  • Maven build completed successfully

Testing was performed on Windows using PowerShell.

Screenshots (if appropriate)

Not applicable.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Unable to load credentials from any of the providers" for parallel calls to an S3Client with ProfileCredentialsProvider

1 participant