You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "davidzollo (via GitHub)" <gi...@apache.org> on 2026/09/14 15:17:15 UTC
[PR] [Fix][Zeta] Route checkpoint barrier dispatch RPC failures to the coordinator instead of dropping them [seatunnel]
davidzollo opened a new pull request, #12314:
URL: https://github.com/apache/seatunnel/pull/12314
## Summary
`CheckpointCoordinator#startTriggerPendingCheckpoint` fires every per-task checkpoint barrier RPC via `triggerCheckpoint()` (which returns `InvocationFuture<?>[]`, `CheckpointCoordinator.java:1167-1179`), but only ever waited for:
```java
CompletableFuture.allOf(completableFutureArray).get();
```
`completableFutureArray` is `CompletableFuture<InvocationFuture<?>[]>` - the future that resolves once `triggerCheckpoint()` has *produced* the array, i.e. once every barrier RPC has been *sent* via `sendOperationToMemberNode`. Because `InvocationFuture` extends the JDK `java.util.concurrent.CompletableFuture` (`InvocationFuture -> AbstractInvocationFuture -> InternalCompletableFuture -> java.util.concurrent.CompletableFuture`), the type system silently accepted wrapping that single array-producing future as one varargs element to `allOf(...)`. The per-task RPCs themselves - the actual `InvocationFuture` elements inside the array - were never observed anywhere else in the method (the array is used only to build this one `allOf(...)` call).
Consequence: a barrier RPC that fails permanently (target member left, or a non-retryable Hazelcast operation failure) is a dead letter. The only backstops are the `checkpoint.timeout` scheduled task (`CheckpointCoordinator.java:1019-1047` after this change, previously ~`:972-1001`) which reports a generic `CHECKPOINT_EXPIRED` only after the full timeout elapses, and member-removal handling. This is bounded (not P0) but delays detection and hides the real failure cause behind a generic timeout.
This was raised during review of #12111 (E2E coverage for this exact dead-letter scenario); the reviewer requested a production fix rather than test-only coverage.
## Fix
In `startTriggerPendingCheckpoint` (the only method touched, `CheckpointCoordinator.java`):
1. Keep the existing `.get()` on `completableFutureArray` unchanged in behavior (same catch blocks, same `CHECKPOINT_INSIDE_ERROR` handling for the synchronous-throw path used by #10448) - now capturing the returned array into `InvocationFuture<?>[] barrierFutures`.
2. Observe the real per-task futures **asynchronously and non-blocking**: `CompletableFuture.allOf(barrierFutures).whenCompleteAsync((ignored, throwable) -> {...}, executorService)`.
- Non-blocking is essential: the `checkpoint.timeout` scheduled task right after this block is the only backstop for an RPC that never completes at all (member hang, network partition before Hazelcast's own retries give up); a blocking join here would prevent that timeout from ever getting scheduled.
- `executorService` is ultimately the `SynchronousQueue`-backed pool created by `CoordinatorService#createCoordinatorExecutor` (`CoordinatorService.java:287-298`), which rejects new work once its threads are busy - a blocking wait on this thread could starve other pipelines' checkpoint coordination sharing the same pool.
3. On a real failure, guard against a stale callback: by the time a slow RPC finally fails, the checkpoint may already have completed and been removed from `pendingCheckpoints` (`completePendingCheckpoint`, `CheckpointCoordinator.java:1420`), or the whole coordinator may already be closed. The callback checks `pendingCheckpoints.containsKey(checkpointId)` (mirroring the same idiom already used by the `checkpoint.timeout` task) before calling `handleCoordinatorError`, so a late failure belonging to an already-completed checkpoint is a no-op.
4. Route a real failure to `handleCoordinatorError(..., CheckpointCloseReason.CHECKPOINT_INSIDE_ERROR)` - the same reason already used for the synchronous-throw path in this method (the #10448 path), so the coordinator now reports the actual dispatch failure immediately instead of a generic `CHECKPOINT_EXPIRED` after the full timeout.
Blast radius: every checkpoint and savepoint trigger goes through this method, so this changes the failure-detection latency/cause for *any* barrier dispatch RPC failure across all pipelines - previously silent-until-timeout, now immediate with the real cause. No behavior changes when barrier RPCs succeed.
## Test-double fix (required by this change)
`CheckpointCoordinatorTest`'s `TestCheckpointManager` and a couple of inline `Mockito.mock(CheckpointManager.class)` stubs (`buildMinimalCoordinator`) return `null` from `sendOperationToMemberNode(...)`. That `null` previously never reached `allOf(...)` since only the array-producing future was observed; with this fix, `CompletableFuture.allOf(barrierFutures)` would `NullPointerException` synchronously on a `null` array element, and since that call sits inside a `thenAccept(...)` continuation whose result is never read, the exception would be silently swallowed - hanging the checkpoint forever with no error surfaced.
I audited every existing test that reaches `startTriggerPendingCheckpoint` for real (not via a `Mockito.doNothing()`-stubbed `tryTriggerPendingCheckpoint`):
- `testFilteringClosedTasksAndActions` uses `TestCheckpointManager` (returns `null`), but calls `coordinator.triggerCheckpoint(barrier)` **directly** - it never goes through `startTriggerPendingCheckpoint`, so it's unaffected.
- `testSchedulerThreadShouldNotBeInterruptedBeforeJobMasterCleaned`, `testCheckpointContinuesWorkAfterClockDrift`, `testCheckpointMinPause` all use a real (or real-delegating) `CheckpointManager` whose `sendOperationToMemberNode` dispatches a genuine (non-null) Hazelcast `InvocationFuture`.
- No existing test's happy path actually feeds a `null` element into the new `allOf(barrierFutures)` call. No test-double changes were needed to keep existing tests passing.
## New tests (`CheckpointCoordinatorTest.java`)
- **`testBarrierDispatchFailureIsRoutedToCoordinatorError`**: stubs `sendOperationToMemberNode` to return an already `completeExceptionally`'d `InvocationFuture`. Since `InvocationFuture` is `final` with a package-private constructor (cannot be subclassed or instantiated from test code), it is mocked via Mockito's inline mock maker (already enabled for this module via `src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker` = `mock-maker-inline`, and already used elsewhere in this file for the same class and for `Mockito.mockStatic`). `completeExceptionally` is stubbed with `doCallRealMethod()` so it genuinely runs the inherited JDK `CompletableFuture#completeExceptionally` on that instance, setting its real internal completion state - which `CompletableFuture.allOf(...)`'s own internals read directly. The checkpoint timeout is configured to 10 minutes, far longer than the test's 10-second Awaitility bound, so a pass can only be explained by the new asynchronous path,
not the timeout backstop. Asserts `handleCoordinatorError` is invoked with `CHECKPOINT_INSIDE_ERROR` and the real cause (allowing for the `CompletionException` wrapping that `CompletableFuture.allOf(...)` applies per its documented contract).
- **`testStaleBarrierDispatchFailureForCompletedCheckpointIsIgnored`**: same failing RPC, but the checkpoint id is deliberately never registered in `pendingCheckpoints` (simulating a checkpoint that already completed and was removed). Asserts `handleCoordinatorError` is never called within a bounded wait - the stale-callback guard.
## Verification
- `./mvnw spotless:apply -pl seatunnel-engine/seatunnel-engine-server -nsu -Dmaven.gitcommitid.skip=true` - clean, no additional formatting changes.
- Per this task's constraints, no local compile, test, or other build/run verification was performed. Every symbol, signature, and generic type used in the production change and the new tests was manually verified against the pinned source at this PR's base commit (including a `javap` inspection of the shaded Hazelcast jar to confirm `InvocationFuture`'s exact class hierarchy and that it is `final`). GitHub CI on this PR's head is the verification of record for compilation and test execution.
## Test plan
- [ ] GitHub CI (compile + `seatunnel-engine-server` unit tests) passes on this PR's head.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Zeta] Route checkpoint barrier dispatch RPC failures to the coordinator instead of dropping them [seatunnel]
Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on PR #12314:
URL: https://github.com/apache/seatunnel/pull/12314#issuecomment-6538167501
GitHub now reports an actual content conflict (CONFLICTING / DIRTY), superseding the earlier no-conflict snapshot on this unchanged head. Please reconcile the latest base while preserving both this PR's change and the intervening upstream work, then obtain required checks on the resulting commit. This request is based on the conflict, not the number of commits behind. Existing-head CI cannot validate that future resolution.
The existing terminal/shutdown-race proof or guard request remains open. The earlier separately evidenced test-selection CI issue is not treated as source clearance.
Checked 2026-10-31T03:04:07.331010+00:00; unchanged head `7ee96e15bd9242a8fc88120df4c239e7bd6fab77`. [Signal pull request update](https://github.com/apache/seatunnel/actions/runs/39984456225/job/121480128829)=`SUCCESS`; [Build](https://github.com/apache/seatunnel/runs/121483781481)=`FAILURE`.
This is a discussion/CI clarification, not another full source review or an effective maintainer approval. Daniel has READ repository permission; a write-capable maintainer owns required approval/dismissal.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Zeta] Route checkpoint barrier dispatch RPC failures to the coordinator instead of dropping them [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on code in PR #12314:
URL: https://github.com/apache/seatunnel/pull/12314#discussion_r4010811242
##########
seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -1183,6 +1183,229 @@ void testRestoreCoordinatorShouldNotTriggerCheckpointWhenNotifyCompletedFails()
}
}
+ /**
+ * Builds an already-completeExceptionally'd {@code InvocationFuture} mock that behaves like a
+ * genuinely failed barrier-dispatch RPC for {@code CompletableFuture.allOf(...)}.
+ *
+ * <p>{@code InvocationFuture} is a final Hazelcast class with a package-private constructor, so
+ * it cannot be subclassed or instantiated directly from test code; it is mocked here using
+ * Mockito's inline mock maker (enabled for this module via {@code
+ * src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker}), which mocks the class
+ * in place rather than generating a subclass. {@code completeExceptionally} is stubbed with
+ * {@code doCallRealMethod()} so the call genuinely runs the inherited {@code
+ * java.util.concurrent.CompletableFuture#completeExceptionally} implementation on this exact
+ * instance, setting its real internal completion state. That state is read directly (not
+ * through any overridable method) by the JDK's own {@code CompletableFuture.allOf(...)}
+ * internals, so the resulting future correctly observes this failure exactly as it would for a
+ * real, permanently-failed barrier RPC.
+ *
+ * @param cause the exception the simulated barrier dispatch RPC fails with
+ * @return a mock {@code InvocationFuture} already completed exceptionally with {@code cause}
+ */
+ private InvocationFuture<?> completedExceptionallyInvocationFuture(Throwable cause) {
+ InvocationFuture<?> future = Mockito.mock(InvocationFuture.class);
+ Mockito.doCallRealMethod().when(future).completeExceptionally(Mockito.any(Throwable.class));
Review Comment:
This helper does not create an exceptionally completed `InvocationFuture`. Mockito bypasses the Hazelcast constructor, leaving the future's internal state uninitialized, so calling the real `completeExceptionally` method here never completes the JDK stage. On Java 11, I reproduced the positive test timing out; the stale-callback test can pass without its callback running.
Please use a real or faithfully initialized future and assert that both callback paths actually execute.
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinator.java:
##########
@@ -1016,6 +1031,48 @@ private void startTriggerPendingCheckpoint(
CheckpointCloseReason.CHECKPOINT_INSIDE_ERROR);
return;
}
+ // Observe the real per-task barrier dispatch futures asynchronously so a
+ // dispatch failure is reported immediately with its real cause, instead of
+ // being silently dropped until the checkpoint.timeout backstop below fires.
+ // This must stay non-blocking: the checkpoint.timeout scheduled task is the
+ // only backstop for a barrier RPC that never completes at all (member hang, or
+ // a network partition before Hazelcast's own retries give up), so this method
+ // must still return promptly and let that timeout get scheduled below.
+ // Blocking here would also risk executor starvation: executorService is
+ // ultimately the SynchronousQueue-backed pool created by
+ // CoordinatorService#createCoordinatorExecutor, which rejects new work once
+ // its threads are busy, so a blocking join on this thread could starve other
+ // pipelines' checkpoint coordination sharing the same pool.
+ CompletableFuture.allOf(barrierFutures)
+ .whenCompleteAsync(
+ (ignored, throwable) -> {
+ if (throwable == null) {
+ return;
+ }
+ // Guard against a stale callback: by the time a slow RPC
+ // finally fails, this checkpoint may already have
+ // completed and been removed from pendingCheckpoints (see
+ // completePendingCheckpoint), or the whole coordinator may
+ // already be closed. handleCoordinatorError itself is a
+ // no-op once checkpointCoordinatorFuture is done, but
+ // pendingCheckpoints is keyed per checkpoint id, so check
+ // it explicitly to avoid failing the coordinator because
+ // of a late failure that belongs to an already completed
+ // checkpoint.
+ if (!pendingCheckpoints.containsKey(
Review Comment:
Checking only map membership leaves a race after the last task acknowledgment. `PendingCheckpoint` becomes fully acknowledged and completes its future before `completePendingCheckpoint` persists the state, sends notifications, and removes this entry. If the barrier RPC was processed but its response later fails during that window, this callback fails the coordinator even though the checkpoint already succeeded.
Please also require `!pendingCheckpoint.isFullyAcknowledged()`, as the timeout guard below already does, or make the state transition atomic and cover this race in a test.
##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/checkpoint/CheckpointCoordinator.java:
##########
@@ -1016,6 +1031,48 @@ private void startTriggerPendingCheckpoint(
CheckpointCloseReason.CHECKPOINT_INSIDE_ERROR);
return;
}
+ // Observe the real per-task barrier dispatch futures asynchronously so a
+ // dispatch failure is reported immediately with its real cause, instead of
+ // being silently dropped until the checkpoint.timeout backstop below fires.
+ // This must stay non-blocking: the checkpoint.timeout scheduled task is the
+ // only backstop for a barrier RPC that never completes at all (member hang, or
+ // a network partition before Hazelcast's own retries give up), so this method
+ // must still return promptly and let that timeout get scheduled below.
+ // Blocking here would also risk executor starvation: executorService is
+ // ultimately the SynchronousQueue-backed pool created by
+ // CoordinatorService#createCoordinatorExecutor, which rejects new work once
+ // its threads are busy, so a blocking join on this thread could starve other
+ // pipelines' checkpoint coordination sharing the same pool.
+ CompletableFuture.allOf(barrierFutures)
+ .whenCompleteAsync(
Review Comment:
This callback can be rejected by the same coordinator executor. That pool uses a `SynchronousQueue` with `AbortPolicy`; when all coordinator threads are busy, `whenCompleteAsync` completes only its returned stage with `RejectedExecutionException` and this handler never runs. Because the returned stage is ignored, the dispatch failure is again delayed until the generic checkpoint timeout.
Please use a callback path that cannot be dropped, or add an explicit rejection fallback and a saturated-pool regression test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Zeta] Route checkpoint barrier dispatch RPC failures to the coordinator instead of dropping them [seatunnel]
Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on PR #12314:
URL: https://github.com/apache/seatunnel/pull/12314#issuecomment-7207757737
The merge-gate fact cited previously has changed: GitHub now reports **actual content conflicts** with dev on this unchanged head. Please resolve those conflicts against current dev while retaining the reviewed feature, fixes and regression coverage, then obtain checks for the resulting head. This request is based on a content conflict, not merely on being behind; it does not claim that synchronization cures the existing CI failure.
My previous source-clear conclusion remains; the previously recorded failed CI is still a validation gate.
Unchanged head `989112c369b7ddc0340a92dcab393d5bab9ba0af`; base `dev`; compare `diverged`, ahead 4 / behind 69. This is a CI/merge-state correction, not another full source review. No local build/test/runtime execution was performed. Daniel has READ permission; effective maintainer approval and historical-review dismissal remain separate actions.
Current snapshot (2026-11-27T03:00:54.699842+00:00): Signal pull request update: SUCCESS; Build: FAILURE; merge state `DIRTY`; review decision `REVIEW_REQUIRED`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Zeta] Route checkpoint barrier dispatch RPC failures to the coordinator instead of dropping them [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12314:
URL: https://github.com/apache/seatunnel/pull/12314#issuecomment-6397570634
Thanks for the contribution. The CI fact in my previous review has changed: the exact-head [fork Build](https://github.com/DanielLeens/seatunnel/actions/runs/39984445999) is now **completed with failure**, rather than queued/in progress. This updates the old guidance; I am not posting a second source review on the unchanged head `7ee96e15bd9242a8fc88120df4c239e7bd6fab77`.
The [inspected failed job](https://github.com/DanielLeens/seatunnel/actions/runs/39984445999/job/120574848238) reports `PreconditionViolationException: None of the supporting TestTemplateInvocationContextProviders ... provided a non-empty stream`. Specifically: HbaseIT (22 errors); inspected transform-v2 part-2, all-connectors-it-2, all-connectors-it-6, and MySQL CDC job samples have the same empty TestTemplate-provider signature.
There is an upstream fix already in latest dev: [#12895](https://github.com/apache/seatunnel/pull/12895), commit `b65fe82b040c203ce669db83431916108f3e866e`. It adds `ContainerSelectionCondition` to skip a suite/method when every engine selected by `RUN_ENGINES` is explicitly disabled, instead of passing an empty invocation stream to JUnit. A genuinely empty container discovery still remains an error. I checked that this head does not contain that commit, and this PR does not change that shared E2E framework.
The comparison is `diverged`, ahead 3 / behind 13 against dev, with no reported conflict. For this demonstrated upstream test-selection failure, please **sync latest dev and rerun the affected failed jobs first**. Do not copy unrelated framework changes into this PR or add dependencies to chase the old failure. Correctly skipped unsupported-engine cases are not runtime test passes; inspect the refreshed run for any other failures and preserve the relevant engine coverage.
My previous Issue 1 still needs the requested proof or guard for the terminal/shutdown race. This CI correction does not clear that code-side question; both gates must be addressed. A successful current-head required Build and write-capable maintainer approval remain separate merge gates. Daniel has READ permission; this follow-up is not an effective approval. Thanks for keeping the patch focused.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org