You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "CryoThrust (via GitHub)" <gi...@apache.org> on 2026/09/16 07:21:04 UTC
[I] [Improve][Zeta] Evaluate the not-started check under the same monitor as the job status transition [seatunnel]
CryoThrust opened a new issue, #12342:
URL: https://github.com/apache/seatunnel/issues/12342
## Description
Follow-up from #12156 review (F2). Not a regression report; the race is pre-existing.
Verified at `dev` commit `4c25d9a62c68f9a7e13e404c1a81b3a3c56886de` (the #12156 head, after that PR replaced the ordinal range checks):
- `PhysicalPlan.cancelJob()` and `PhysicalPlan.stopJob()` evaluate `NOT_STARTED_STATUSES.contains(jobStatus)` and then call `updateJobState(...)` as two separate steps.
- `updateJobState` (`PhysicalPlan.java:323`) is `synchronized` on the `PhysicalPlan` instance, and so are `startJob()` (`:379`) and `stateProcess()` (`:391`).
- The not-started check is *outside* that monitor, so a job can move from `PENDING`/`CREATED`/`INITIALIZING` to `SCHEDULED`/`RUNNING` between the check and the transition. In that window `cancelJob()` would take the `CANCELED` shortcut for a job that has just started, skipping the `CANCELING` drain path.
## Why it was not folded into #12156
Moving the check under the `updateJobState` monitor changes lock ordering with `startJob()`/`stateProcess()`, rather than just relocating a condition. That deserves its own review, so #12156 deliberately kept its diff to the ordinal-check replacement plus tests and documentation.
## Expected outcome
- Decide whether the not-started check should be evaluated under the same monitor as the transition it guards (a `synchronized` helper on `PhysicalPlan`, or a single method owning both steps), or whether the race is unreachable in practice — in which case it should be stated why, with a test that pins it.
- If the check moves under the monitor, keep the `NOT_STARTED_STATUSES` semantics from #12156 unchanged: a job in `INITIALIZING`/`CREATED`/`PENDING` goes straight to `CANCELED` with no `CANCELING` transition.
- Add regression coverage for the interleaving, not just the two static outcomes: the existing tests in `StateTransitionCleanupTest` assert the classification for a quiescent job and cannot observe a check-then-act race.
## Related
- PR: #12156 (adds `NOT_STARTED_STATUSES`, `PhysicalPlan`-level cancel tests)
- Review thread: #12156 comment on F2
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Improve][Zeta] Evaluate the not-started check under the same monitor as the job status transition [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12342:
URL: https://github.com/apache/seatunnel/issues/12342#issuecomment-5697151254
Thanks for separating this from #12156. The current `dev` path confirms the check-then-act boundary: `cancelJob()` and `stopJob()` read the state before entering the synchronized `updateJobState(...)` transition, while `startJob()` and `stateProcess()` use the same `PhysicalPlan` monitor. A job can therefore cease to be not-started between the outer read and the transition.
Please keep this as a separate follow-up, but do not build it on the current ordinal predicates: #12156 has not merged and its current Build is failing. After that PR is green and merged, rebase this work and make one synchronized helper own the state read, exact not-started classification, transition, and direct completion side effect. The helper must preserve the agreed `INITIALIZING` / `CREATED` / `PENDING` direct-cancel behavior while using the then-current explicit status set rather than reintroducing an ordinal range.
The regression needs a deterministic latch-based interleaving, not only static state assertions: arrange for the old outer observation to see a not-started state, advance the plan to `SCHEDULED` or `RUNNING` before the guarded decision, and prove the normal cancelling/drain path wins. Cover both cancel and stop, and audit the resulting monitor ordering against `startJob()` / `stateProcess()` before proposing a PR.
--
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