zhangshenghang opened a new issue, #13536: URL: https://github.com/apache/seatunnel/issues/13536
### Search before asking - [x] I searched the [issues](https://github.com/apache/seatunnel/issues) and found no similar issues. ### What happened + What you expected to happen On `dev` (`ee0fb0d72f`), with a 2-master + 1-worker Zeta cluster, `dynamic-slot = false`, `slot-num = 3` and `job-schedule-strategy = WAIT`: 1. Submit a streaming job that occupies all three fixed slots (FakeSource split enumerator, reader/writer, InMemory aggregated committer). 2. Shut down the active master. The standby takes over and re-enters the running job into the pending queue as `PENDING` (its worker tasks are intentionally kept and their slots reused, see `JobMaster#getReusableSlot`). 3. Cancel that job while it is `PENDING` on the new master. **Expected:** the cancel stops the job's worker tasks and releases its three fixed slots, so a pending restore (or any other job) queued behind it can be scheduled. **Actual:** the job status becomes `CANCELED`, but the worker tasks keep running and all three fixed slots stay assigned to the canceled job forever. `ResourceManager` keeps reporting the canceled job as the slot owner: ``` WorkerProfile(... assignedSlots=[ SlotProfile{slotID=0, ownerJobID=<cancelled job>, ...}, SlotProfile{slotID=1, ownerJobID=<cancelled job>, ...}, SlotProfile{slotID=2, ownerJobID=<cancelled job>, ...}], unassignedSlots=[]) ``` The pending-job scheduler then retries forever: ``` Apply resource not success for job: <restore job>, required: 1 slots, obtained: 0 slots Pre resource application failed for job: <restore job>, success: 0, failed: 3/3 ``` The worker tasks were only interrupted when the worker itself was shut down at the end of the test. A fixed slot pool therefore stays permanently occupied after this sequence, and every later job on that pool stays `PENDING`. ### Root cause `PhysicalPlan#cancelJob()` / `#stopJob()` treat every job whose status is `<= PENDING` as "never started": they transition the job straight to `CANCELED` without canceling any pipeline and without releasing slots. That assumption does not hold for a job restored after an active-master switch. `CoordinatorService#restoreJobFromMasterActiveSwitch` re-enqueues the job as `PENDING` while the worker still runs the task groups deployed by the previous master and still owns their slots. `CoordinatorService#cancelJob` also removes the pending entry before calling `JobMaster#cancelJob()`, so the later task-state callbacks can no longer find the `JobMaster` and cannot release anything either. ### How to reproduce The sequence is covered by an E2E test (`PendingRestoreMasterFailoverIT`) that fails on `dev` and passes with the fix: a savepoint restore is parked behind the restored job, the restored job is canceled while `PENDING`, then the queued restore must reach `RUNNING` on the freed slots. ### Anything else I will open a PR that cancels the already-deployed task groups of a pending job and releases their persisted slot ownership before completing the job as `CANCELED`. A plain pending job (no pipeline ever left `CREATED`) keeps the previous fast path. ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
