Skip to content

Add AWSAuthFactory.createCloseable to release the assume-role STS client - #26808

Open
patrickmann wants to merge 1 commit into
masterfrom
fix/aws-auth-factory-closeable-sts-client
Open

Add AWSAuthFactory.createCloseable to release the assume-role STS client#26808
patrickmann wants to merge 1 commit into
masterfrom
fix/aws-auth-factory-closeable-sts-client

Conversation

@patrickmann

@patrickmann patrickmann commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

/nocl

Description

AWSAuthFactory.buildStsCredentialsProvider creates an StsClient and hands it to StsAssumeRoleCredentialsProvider, which never closes it: StsCredentialsProvider.close() only clears the session cache. A caller that builds a credentials provider per operation therefore leaks the STS client's Apache connection pool on every call.

This adds AWSAuthFactory.createCloseable(...), which returns a CredentialsProviderHandle bundling the provider with its STS client so a caller can close both. The existing create(...) overloads delegate to it and discard the handle, so their behaviour is unchanged.

First consumer is the Data Lake backend validator fix in Graylog2/graylog-plugin-enterprise#15011.

How Tested

  • AWSAuthFactoryTest: two new cases (assume-role handle closes the STS client and provider; static-credentials handle has no STS client and closes safely).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have added tests to cover my changes.

buildStsCredentialsProvider hands a fresh StsClient to
StsAssumeRoleCredentialsProvider, which never closes it:
StsCredentialsProvider.close() only clears the session cache. A caller
that builds a provider per operation therefore leaks the STS client's
Apache connection pool on every call.

Add createCloseable(...), returning a CredentialsProviderHandle that
bundles the provider with its STS client so a caller can close both.
The existing create(...) overloads delegate to it and discard the
handle, so their behaviour is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@patrickmann
patrickmann marked this pull request as ready for review July 28, 2026 14:33
@patrickmann
patrickmann requested review from a team and Copilot July 28, 2026 14:33

This comment was marked as resolved.

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.

2 participants