Skip to content

fix: catch UncheckedIOException in RetryableStage to enable retry (#6578)#6856

Open
anuragg-saxenaa wants to merge 1 commit intoaws:masterfrom
anuragg-saxenaa:fix/issue-6578-uncheckedioexception-not-retried-v2
Open

fix: catch UncheckedIOException in RetryableStage to enable retry (#6578)#6856
anuragg-saxenaa wants to merge 1 commit intoaws:masterfrom
anuragg-saxenaa:fix/issue-6578-uncheckedioexception-not-retried-v2

Conversation

@anuragg-saxenaa
Copy link
Copy Markdown

Description

RetryableStage catches SdkException | IOException but not UncheckedIOException. Since UncheckedIOException extends RuntimeException (not IOException), it bypasses the catch block and is never evaluated against user-supplied retry predicates. This means retryOnException(UncheckedIOException.class) has no effect.

Root Cause

// Before fix — UncheckedIOException escapes the catch and is never retried
} catch (SdkExceptionWithRetryAfterHint | SdkException | IOException e) {

Fix

} catch (SdkExceptionWithRetryAfterHint | SdkException | IOException | UncheckedIOException e) {

Adding UncheckedIOException to the multi-catch means it is forwarded to RetryableStageHelper.tryRefreshToken, which evaluates user-supplied retry predicates correctly. No other behavior changes — UncheckedIOException will only be retried when the user explicitly registers a predicate that matches it (e.g. retryOnException(UncheckedIOException.class)).

Fixes #6578

…#6578)

RetryableStage caught SdkException and IOException but not
UncheckedIOException (which extends RuntimeException, not IOException).
When the HTTP client throws UncheckedIOException, it bypassed the catch
block entirely and was never offered to the retry strategy predicates,
so retryOnException(UncheckedIOException.class) had no effect.

Add UncheckedIOException to the multi-catch so it is forwarded to
RetryableStageHelper.tryRefreshToken and evaluated against user-supplied
retry predicates like any other retriable exception.

Fixes aws#6578

Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
@anuragg-saxenaa anuragg-saxenaa requested a review from a team as a code owner April 12, 2026 16:06
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.

RetryOnException in RetryStrategy does not retry on UncheckedIOException

1 participant