Skip to content

fix: cache S3Presigner as singleton to prevent IRSA credential refresh failure#1856

Merged
netomi merged 2 commits into
eclipse-openvsx:mainfrom
achdmbp:fix/s3-presigner-lifecycle
May 26, 2026
Merged

fix: cache S3Presigner as singleton to prevent IRSA credential refresh failure#1856
netomi merged 2 commits into
eclipse-openvsx:mainfrom
achdmbp:fix/s3-presigner-lifecycle

Conversation

@achdmbp

@achdmbp achdmbp commented May 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #1855

The S3Presigner was created and closed on every getLocation() call via try-with-resources. Closing the presigner destroys the HTTP connection pool that DefaultCredentialsProvider needs to refresh IRSA credentials via STS. After ~63 minutes when credentials expire, all presign operations fail with 500 errors.

This change caches the S3Presigner as a singleton field, matching the existing pattern used for S3Client. The presigner stays open for the application's lifetime, allowing credential refresh to work indefinitely.

Changes

  • Cache S3Presigner as a singleton field (lazy initialization)
  • Remove try-with-resources in getLocation() since presigner is now long-lived
  • Add unit tests verifying singleton caching behavior

Testing

  • Unit tests pass (AwsStorageServiceTest)
  • Deployed on OpenShift (ROSA) with IRSA and S3 storage (no CDN)
  • Pod ran for 3+ hours with continuous successful presigned URL generation
  • Well past the previous 63-minute failure point where credentials would fail to refresh

…lure

The S3Presigner was created fresh on every getLocation() call and
immediately closed via try-with-resources. Closing the presigner shuts
down the underlying HTTP connection pool used by DefaultCredentialsProvider
for STS token refresh. After ~63 minutes when IRSA credentials expire,
the next presign attempt fails because the connection pool is dead.

Fix: Cache the S3Presigner as a singleton field (same pattern as S3Client).
The presigner stays open for the lifetime of the application, allowing
DefaultCredentialsProvider to refresh IRSA tokens via its internal HTTP
client without interruption.

Fixes: eclipse-openvsx#1855
Signed-off-by: Adnan Al <98621989+achdmbp@users.noreply.github.com>
@netomi netomi force-pushed the fix/s3-presigner-lifecycle branch from 60135ec to 10519ec Compare May 22, 2026 08:05
@netomi

netomi commented May 22, 2026

Copy link
Copy Markdown
Contributor

I protected the lazy initialization with double-checked locking and avoided code duplication. Also the objects are closed properly. Please check on your side, the changes look fine to me otherwise.

@svor

svor commented May 26, 2026

Copy link
Copy Markdown
Contributor

@achdmbp could you please double-check whether the problem is fixed with the current changes?

@netomi netomi merged commit 3dcd5ab into eclipse-openvsx:main May 26, 2026
8 checks passed
@achdmbp achdmbp deleted the fix/s3-presigner-lifecycle branch May 26, 2026 15:45
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.

S3Presigner credential refresh fails after ~60 minutes when using IRSA

3 participants