Repository navigation
[FLINK-41192][connector-http] Fail the HTTP sink request when a retry attempt throws - #62
Open
bharathgunapati wants to merge 1 commit into
Conversation
… attempt throws Resilience4j does not catch an exception thrown while starting an attempt. On a retry attempt, which runs on the retry scheduler, the exception was lost and the request future never completed, so the sink request stayed in flight until the AsyncSink request timeout and was then resent whole. Wrap the attempt so such an exception becomes a failed stage: an I/O failure in its cause chain is retried like a transport error, anything else fails the request through the writer's existing exception path. Generated-by: Claude Code (Claude Fable 5.1)
Contributor
Author
|
@MartijnVisser this is the fix for FLINK-41192, which you filed. An exception thrown while starting an attempt now becomes a failed stage, so Resilience4j's The three new tests in Since #58 makes the bug reachable through the per-request token fetch, this should go in before #58. Could you approve the CI run when you get a chance? Thanks. |
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.
Purpose of the change
https://issues.apache.org/jira/browse/FLINK-41192
HttpSinkClientWithRetryhands each attempt to Resilience4j'sRetry.decorateCompletionStage. Resilience4j 1.7.1 does not catch an exception thrown while starting an attempt. On the first attempt the exception reaches the caller, but a retry attempt runs on the retry scheduler, where the exception is lost and the returned future never completes. The sink request then stays in flight until the AsyncSink request timeout (10 minutes by default), blocking checkpoints, and is afterwards resent as a whole batch including entries the first attempt already delivered.On main this needs an attempt that fails deterministically only on a retry. With FLINK-40279 (#58) the OIDC token is fetched while building each request, so a token endpoint failure during a retry triggers it. Introduced with FLINK-40277, not released.
Brief change log
HttpSinkClientWithRetrywraps the attempt submitter: an exception thrown while starting an attempt becomes a failed stage. Resilience4j then applies the existingretryOnExceptionrule, so a failure with anIOExceptionin its cause chain is retried like a transport error, and anything else fails the request, whichHttpSinkWriterreports through its existing exception path.putRequests, which is whatHttpSinkWriterexpects anyway.Verifying this change
HttpSinkClientWithRetryTest: a retry attempt that throws completes the request exceptionally with the original cause; a retry attempt that throws with anIOExceptioncause is retried and succeeds on the next attempt; a first attempt that throws completes exceptionally. All three time out on the unfixed code (5 s bound) and pass with the fix.JavaNetSinkHttpClientTest: the same scenario through the real sink client with a submitter that returns 503 first and throws on the retry.spotless:check checkstyle:checkclean.Impact and documentation
HttpSinkWritercould set an AsyncSink request timeout derived fromhttp.sink.request.timeoutand the retry settings, so that any future hang is bounded. Left out here to keep the bug fix minimal.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Fable 5.1)