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/01 01:51:26 UTC
[PR] [Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover [seatunnel]
davidzollo opened a new pull request, #12027:
URL: https://github.com/apache/seatunnel/pull/12027
## Purpose
Adds multi-node E2E regression coverage for the duplicate/lost pending-job
dispatch race fixed in #11653 ("[Fix][Zeta] Avoid duplicate pending job
scheduling after failover").
That fix introduced a monotonic scheduling epoch so a scheduler thread from
a stale master generation cannot dispatch a pending job that a newer
generation has already claimed, and made `clearCoordinatorService`
unconditionally drop interrupted pending jobs from the local queue so a
later flap-back cannot re-dispatch a poisoned `JobMaster`. It already ships
with four thorough unit tests in `CoordinatorServiceTest` that prove the
epoch/lock mechanism correct in isolation via mocked `CoordinatorService`
and reflection.
What was still missing: proof that the same invariant holds through the
real multi-node integration path — real client job submission, real
Hazelcast membership changes, and real resource contention — rather than a
single JVM driving the internal method calls directly.
## What this test does
`SplitClusterPendingJobLifecycleFailoverIT#testPendingJobNotDuplicatedAcrossRepeatedMasterFailover`:
1. Starts a split-role cluster (2 master-eligible nodes + 1 worker, fixed
4-slot capacity, `ScheduleStrategy.WAIT`).
2. Submits a long-running "holder" job that saturates all worker slots.
3. Submits a small bounded batch "contested" job, which goes `PENDING`
since no slots remain. Because the strategy is `WAIT`, the scheduler
thread repeatedly re-evaluates this job on a fixed 3-second cadence —
this gives the test a wide, deterministic window to land repeated
failovers while the job is under active scheduler evaluation, instead
of chasing a microsecond-scale race.
4. Repeatedly flaps master ownership (4 rounds): kills the active master,
waits for the standby to take over, then starts a fresh replacement
master-eligible node so there is always a standby ready for the next
round.
5. After all flaps, confirms the contested job is still tracked as a
single `PENDING` entry (not lost, not duplicated), then cancels the
holder job to free capacity and lets it actually run.
6. Asserts the job reaches `FINISHED` with **exactly** the expected row
count. The contested job is a bounded batch job specifically so this
count is exact rather than a lower bound: if it were ever dispatched
twice as two independent `JobMaster` instances, the sink would end up
with double the expected rows instead of matching precisely.
## Why this belongs at the E2E layer, not just as another unit test
The existing `SplitClusterPendingJobLifecycleFailoverIT` already proves a
pending job survives a *single* clean master failover, but never times the
kill to land while the job is actively mid-evaluation, and has no
assertion against duplicate dispatch (only status-transition checks). The
new test closes both gaps using entirely existing harness capabilities —
no new test infrastructure was needed.
## Test plan
- New test only; no production code changed.
- `./mvnw spotless:apply` run on the affected module.
- `./mvnw install -DskipTests` run on the affected module and its
dependency chain to confirm the new test compiles cleanly (this repo's
shaded modules need `install`, not bare `compile`/`test-compile`, to
resolve relocated classes) — build succeeded.
- Full test execution is left to CI per this repository's E2E conventions
(Testcontainers/Hazelcast-backed, not run in this sandbox).
--
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] [Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #12027:
URL: https://github.com/apache/seatunnel/pull/12027#issuecomment-5549660009
### CI update for head `bcf9ad1` — correcting my previous analysis: the restore-retry fix is **not** the fix for this failure
Run [33942761744](https://github.com/davidzollo/seatunnel/actions/runs/33942761744) is in, and it disproves the hypothesis I posted on `db88893`.
- `engine-v2-it (11)`: **same failure, unchanged** — `testPendingJobNotDuplicatedAcrossRepeatedMasterFailover`, `expected: <FINISHED> but was: <PENDING> within 3 minutes` (`SplitClusterPendingJobLifecycleFailoverIT.java:399`).
- `engine-v2-it (8)`: no signal — it died before reaching any test, on a Maven Central transport error (`com.google.auto:auto-common:jar:1.2: Connection reset`, build stopped at `-rf :seatunnel-config-shade`). Pure infrastructure, unrelated to this PR.
So `73aaf491` ("Retry master-switch job restore on transient failure") does not change this outcome. Retracting the earlier claim that an abandoned restore future was the cause.
#### What the run actually shows
The restore path works. On the final master, the contested job's `JobMaster` is alive and re-applying for resources every ~3s for the whole 180s window:
```
04:09:33 ResourceRequestHandler - Apply resource not success for job: 1148469947324760066,
required: 1 slots, applied: 0
04:09:33 ResourceRequestHandler - request slot with retry error: ...NoEnoughResourceException
04:09:33 JobMaster - Pre resource application failed ... failed: 3/3
... identical, every ~3s, through 04:13:01 (test gives up)
```
The job is not lost, not duplicated, and not stuck in restore. **It is starved of slots.** The timeline is what makes this damning:
```
04:09:33.042 PhysicalPlan - Job pending_job_duplicate_dispatch_holder (…694530) state process is stopped
04:09:33.213 ResourceRequestHandler - Apply resource not success for job: …760066, required: 1 slots, applied: 0
```
The holder job — which occupies all 4 of the worker's slots (`configurePendingLifecycleTest` sets `dynamicSlot=false`, `slotNum=4`) — is cancelled, and its slots are still not available 3.5 minutes later. The worker itself is healthy throughout: the only `AbstractResourceManager - Node heartbeat timeout` entries in the window name `[localhost]:5801` and `[localhost]:5802`, the two master nodes being cycled, never the worker `[localhost]:5803`.
So the engine behaviour under test is: **slots held by a job that is cancelled after repeated master failovers are never returned, and any job waiting on them starves indefinitely.** That is a real defect, and it is arguably a more serious one than the duplicate-dispatch case this test was written for.
#### Where I think it lives, and what I have not yet proven
The release path narrows to `JobMaster#releasePipelineResource` (`seatunnel-engine-server/.../master/JobMaster.java:923`) and `JobMaster#releaseTaskGroupResource` (`:879`), which forward to `DefaultSlotService#releaseSlot` (`.../service/slot/DefaultSlotService.java:203`). That method rejects a release outright, with `WrongTargetSlotException`, in three cases (`:207`, `:212`, `:217`): the slot id is not in `assignedSlots`, the profile's `sequence` does not match the one the worker currently holds, or the profile's owner job id does not match. A restored `JobMaster` rebuilds its view from `ownedSlotProfilesIMap`, so a `SlotProfile` that has gone stale across four master epochs failing the `sequence` check at `:212` would produce exactly the observed end state — worker keeps the slot in `assignedSlots`, every subsequent `WorkerProfile` reports it as assigned, and no later coordinator can ever reclaim it.
I want to be explicit that this last paragraph is a **hypothesis, not a proven root cause**. The E2E capture only retains WARN and above, and the decisive lines (`received slot release request …` at `DefaultSlotService.java:204`, and `release the pipeline %s resource` in `JobMaster#releasePipelineResource`) are INFO, so this run cannot tell me whether the release was attempted and rejected, or never attempted at all. I am not going to guess at a production change on that basis.
#### Consequences for this PR
1. `73aaf491` should come out of this PR. It is an engine change in a `[Test][E2E]` PR that demonstrably does not fix the failure it was added for. The behaviour it addresses (`restoreAllRunningJobFromMasterNodeSwitch` submitted fire-and-forget with no exception handler, on a future no status-read path joins) still looks like a genuine robustness gap to me, but it belongs in its own `[Fix][Zeta]` PR with its own justification, not bundled here.
2. To get the decisive evidence I need one instrumented CI run that raises `DefaultSlotService` and `JobMaster` to INFO for this test, so the slot-release attempt is visible. I would rather spend one cycle on that than another on a guess.
3. I am **not** relaxing the assertion or extending the 180s timeout. The job is not slow; it is receiving `applied: 0` on every single attempt for the entire window, and a longer wait would not change that — it would only hide a real slot leak.
Marking this blocking until the release path is pinned down. Reviewers: if the slot-release-across-epochs behaviour is already known and tracked elsewhere, please point me at it and I will rebase this test onto that fix rather than duplicating the investigation.
--
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] [Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #12027:
URL: https://github.com/apache/seatunnel/pull/12027#issuecomment-5551957247
@DanielLeens Thanks for the thorough re-review. Both points from your last round are now closed out.
### Issue 1 (High, blocking) — resolved by evidence, not by argument
The run you saw as `queued` at review time has since completed, and it is green on the exact head you reviewed (`e9923e5337c`):
- `apache/seatunnel` `Build` check → `conclusion: success`, `head_sha: e9923e5337c`, completed `2026-09-05T12:39:34Z`
- fork run [`33961795042`](https://github.com/davidzollo/seatunnel/actions/runs/33961795042) (same head) → `conclusion: success`
- `Run / engine-v2-it (8, ubuntu-latest)` → **success**
- `Run / engine-v2-it (11, ubuntu-latest)` → **success**
That is the first green result on this test after three consecutive identical failures (`73a8c0da70f`, `e8fc49e1662`/`db8889317`, `bcf9ad180`), and it passed on both JDKs. It confirms the diagnosis: the hang was the holder job's static worker slots never being reclaimed after `cancelJob()` + immediate master shutdown — a separate resource-lifecycle defect — not the epoch-scheduling invariant this test exists to guard. Removing the cancel-and-wait step in favour of growing the cluster is what made the difference.
Agreed on your tracking note as well: this CI evidence lines up with the existing #11437 / #9589 slot-leak reports rather than warranting a third issue, so I'll attach it there instead of opening a new one.
### Issues 2 and 3 — fixed in `222b8bba`
- **Issue 2 (Medium):** added the class-level Javadoc, covering the shared setup (real split cluster, master ownership changes while worker slots are occupied) and all four scenarios in the class, including `testTerminalJobCleanupSkipsWorkerWaitAfterMasterSwitch` that landed independently from #12034.
- **Issue 3 (Low):** you were right, `testPendingJobLifecycleAcrossMasterFailover` exists nowhere in the repo — the only occurrence of that string was the comment itself. Corrected to `testPendingJobLifecycleInMasterFailover`, and I verified it is the right precedent: that test starts a second worker instance after the failover to release its pending job, which is the same pattern the comment describes.
`222b8bba` is **comment-only** — no test logic, no assertion, no helper touched (+23/−1, all Javadoc/comment text; `git diff e9923e53..222b8bba` shows nothing else). Two useful consequences:
1. It cannot regress the green result above.
2. Because the test logic is byte-identical to the head that just passed, the CI run this push triggers is an independent repeat of exactly the same test — which gives you the second confirming run you asked for as part of addressing the nits, rather than as a separate cycle.
I'll report back once that run completes. Verified locally with `./mvnw spotless:apply` on `connector-seatunnel-e2e-base` (clean, no reformatting beyond the change itself); per this repo's workflow all compile/test validation is left to CI.
--
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] [Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12027:
URL: https://github.com/apache/seatunnel/pull/12027#issuecomment-5564068694
@/private/tmp/claude-501/-Users-stone-work-myworkspace-seatunnel-third/36a5ab31-3848-4440-b39c-9326db21568d/scratchpad/reply_12027.md
--
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] [Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #12027:
URL: https://github.com/apache/seatunnel/pull/12027#issuecomment-5548995175
### CI analysis for the current head (`db88893`) — blocking, needs a decision before this PR can go green
`engine-v2-it` fails on **both JDK 8 and JDK 11** with the same signature, so this is deterministic, not flaky:
```
SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover
org.awaitility.core.ConditionTimeoutException: ... expected: <FINISHED> but was: <PENDING> within 3 minutes
at SplitClusterPendingJobLifecycleFailoverIT.assertJobStatusWithTimeout(...:689)
at SplitClusterPendingJobLifecycleFailoverIT.testPendingJobNotDuplicatedAcrossRepeatedMasterFailover(...:399)
```
The failure is confined to this PR's own new test: `CheckpointCoordinatorFailoverIT` passes in this run, and `SplitClusterPendingJobLifecycleFailoverIT` passes on other branches that do not carry this test.
#### What the run actually shows
The pending-job scheduler is **healthy** for the whole 3-minute window — it keeps retrying the contested job every 3s right up to the end of the test:
```
15:34:49,577 WARN ResourceRequestHandler - Apply resource not success for job: 1148279132178677761,
required: 1 slots, applied: 0 slots, releasing slots: [], remaining: 1 slots not assigned
```
So the epoch machinery this PR is guarding is not what breaks. The job never gets its single slot because the worker never has one free. Tracing the holder job (`1148279132178612225`) explains why:
1. `15:31:41` / `15:31:44` — after the 4 master flaps, the **holder job is itself back in the pending queue** and failing its own pre-check:
`Pre resource application failed for job: 1148279132178612225, success: 0, failed: 4/4`.
The holder was deployed and RUNNING, but the successor coordinator has lost its resource ownership and is now re-requesting all 4 slots — against slots its own still-running tasks occupy.
2. `15:31:47.711` — `cancelJob()` takes effect at the coordinator (`state process is stopped`), so `assertEventuallyCanceled` passes on job **status**.
3. `15:31:47.893` — 182 ms later the contested job's next pre-check still reports `remaining: 1 slots not assigned`.
4. `15:31:48.92` — the test shuts the active master down (~1.2 s after the cancel).
5. `15:34:50` (teardown, ~3 min later) — the holder's tasks are **still alive on worker 5803**: `TaskExecutionService` warnings plus `MultiTableWriterRunnable error when write row ...`.
So the holder reached CANCELED at the coordinator while its tasks kept running on the worker, and because the coordinator no longer held any resource record for it, nothing ever told the worker to stop them. All 4 static slots (`slotNum=4`, `dynamicSlot=false`) stay leaked, and the contested job can never be scheduled.
#### Why I am not pushing a fix yet
Two separate things are tangled here and they need different calls:
- **This is not the defect I1 guards.** The test asserts FINISHED as a proxy for "dispatched exactly once". What it actually tripped over is resource-ownership recovery: after repeated failover, an already-deployed job can be re-queued as PENDING with its slot ownership lost, and cancelling it then leaves orphaned tasks plus permanently leaked slots. That is a real robustness gap worth its own issue, but treating it inside this regression-test PR would take the diff deep into the failover/resource-manager path — well past a minimal, reviewable change, and past what I can pin to a specific method and line range with the evidence I have.
- **The test also over-trusts a proxy condition.** `assertEventuallyCanceled` checks job status only; the test then assumes worker slots are free and hands off the master 1.2 s later. Status and slot accounting are not the same thing, so the test creates the race it then fails on.
I am deliberately **not** raising the 180s timeout: the scheduler retried continuously for the full 3 minutes and the slot was never released, so a longer timeout would hide the finding rather than fix anything.
#### Proposed direction (needs a maintainer call)
1. Confirm whether the orphaned-slot / still-running-tasks behaviour after `cancel` + immediate master loss is a defect that should be tracked and fixed separately in `seatunnel-engine-server`. If so I will open a dedicated issue with this evidence rather than widen this PR.
2. Independently, restructure this test so the final handoff no longer depends on that path — the scenario needs the contested job's resources to be observably available before the last master shutdown, rather than inferring it from the holder's job status.
Flagging this as blocking until (1) is decided, since the answer determines whether the fix belongs in this PR or outside it.
--
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] [Test][E2E] Add regression coverage for duplicate pending-job dispatch after failover [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx merged PR #12027:
URL: https://github.com/apache/seatunnel/pull/12027
--
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