Repository navigation
Reuse default STS client across web identity credential refreshes - #3425
Merged
stobrien89 merged 2 commits intoNov 27, 2026
Merged
Conversation
stobrien89
requested changes
Nov 20, 2026
stobrien89
left a comment
Member
There was a problem hiding this comment.
Thanks for the contribution @nathanblogs. Just a couple of comments
| return null; | ||
| } | ||
|
|
||
| return $clients[$region] ??= new StsClient([ |
Member
There was a problem hiding this comment.
This duplicates the client config from AssumeRoleWithWebIdentityCredentialProvider::createDefaultStsClient(). If those drift (e.g. #3399 adds timeouts there), the cached client won't pick them up. Can we share one factory?
| array &$clients | ||
| ): ?StsClient | ||
| { | ||
| $region = $region ?: getenv(self::ENV_REGION); |
Member
There was a problem hiding this comment.
Returning null here means the no-region case still builds a new client every refresh. Could we cache under FALLBACK_REGION and keep the notice?
1 task
assumeRoleWithWebIdentityCredentialProvider() built a new StsClient on every refresh. The discarded clients sit in reference cycles, so long-running processes grow native memory by ~1 MB per refresh until the cycle collector runs. Fixes aws#3424 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build the cached web identity STS client through AssumeRoleWithWebIdentityCredentialProvider::createDefaultStsClient() so it picks up future client settings, and cache it under FALLBACK_REGION when no region is configured. The region notice now fires once per provider instead of on every refresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
nathanblogs
force-pushed
the
fix-web-identity-sts-client-reuse
branch
from
November 24, 2026 14:13
e0aa2aa to
8191e4d
Compare
Member
|
Thanks for the fixes @nathanblogs. I think this is ready for review unless you planned on adding to it more |
stobrien89
marked this pull request as ready for review
November 25, 2026 16:45
stobrien89
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: #3424
Description of changes:
assumeRoleWithWebIdentityCredentialProvider()now creates its defaultStsClientonce per region and reuses it across refreshes, instead of building a new one each time.AssumeRoleWithWebIdentityCredentialProvider::createDefaultStsClient(), nowpublic staticand@internal, so both paths share one factory.FALLBACK_REGION. The region notice now fires once per provider instead of on every refresh.stsClientstill takes precedence.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code