Skip to content

Core: Do not retry Tasks after interrupt - #18213

Open
huaxingao wants to merge 3 commits into
apache:mainfrom
huaxingao:not_retry_interrupt
Open

huaxingao wants to merge 3 commits into
apache:mainfrom
huaxingao:not_retry_interrupt

Conversation

@huaxingao

Copy link
Copy Markdown
Contributor

Tasks.foreach(...).retry(...) treated every failure as retryable unless it was exactly UnrecoverableException. When a job is cancelled, FileIO often wraps InterruptedException in RuntimeException / UncheckedIOException. Iceberg then slept and retried, and the retry could succeed after the caller was already gone (expire-snapshot cleanup is one path that hits this).

This change walks the cause chain. If the failure is InterruptedException, InterruptedIOException, or ClosedByInterruptException, do not retry, restore the interrupt flag, and rethrow.

@github-actions github-actions Bot added the core label Sep 22, 2026
Comment thread core/src/main/java/org/apache/iceberg/util/Tasks.java Outdated
Comment thread core/src/main/java/org/apache/iceberg/util/Tasks.java Outdated
@pvary

pvary commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

There are other places as well where we don't handle interrupts correctly. See: #18236

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants