[FLINK-39998][state] Surface root cause exception when parallel RocksDB state download fails#28552
Open
sameer2800 wants to merge 1 commit into
Open
Conversation
…DB state download fails
Collaborator
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.
What is the purpose of the change
When parallel RocksDB state downloads fail, only the first exception to arrive is surfaced — all other thread failures are silently lost. This is non-deterministic: whichever thread happens to complete first "wins" the primary exception slot, which is often a cascade ClosedChannelException rather than the actual failure.
Consider a real scenario: a checkpoint file gets accidentally deleted from S3. On job restart, Flink keeps crashing. The only error visible in the logs is ClosedChannelException, which points to a local file write issue and gives no hint that a remote file is missing. The on-call engineer has no indication of which file is gone, which checkpoint is affected, or that S3 is involved at all — making diagnosis extremely painful.
Before:
Caused by: java.io.IOException: java.nio.channels.ClosedChannelException
at org.apache.flink.state.rocksdb.RocksDBStateDownloader.downloadDataForStateHandle
After:
Caused by: java.io.IOException: 2 downloads failed with distinct errors:
[IOException: ClosedChannelException | IOException: FileNotFoundException:
No such file: s3://bucket/checkpoints/.../shared/16040859-c981-4407-bf8d-8fd6bbb66f6f]
The root cause: FutureUtils.completeAll() collects all thread failures as suppressed exceptions on a CompletionException. However, CompletableFuture.get() internally strips that wrapper
before throwing ExecutionException — so by the time the catch block runs, all parallel failures except one are permanently gone.
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts: