DanielLeens opened a new issue, #13479: URL: https://github.com/apache/seatunnel/issues/13479
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues. ### What happened When SeaTunnel Zeta engine is configured with `schedule_strategy: WAIT`, submitted jobs that lack sufficient worker slots remain queued in `PENDING` status inside `pendingJobQueue`. If a client then force-stops the pending job (e.g., via `JobClient.cancelJob(jobId, true)` or REST API force stop, which invokes `CoordinatorService.stopJob(jobId)`): 1. `stopJob(jobId)` removes the job from `pendingJobQueue` (`pendingJobQueue.removeById(jobId)`). 2. `stopJob(jobId)` calls `runningJobMaster.stopJob()` asynchronously to transition the PhysicalPlan. 3. However, because the job was pending in the queue, `JobMaster.run()` / `JobMaster.init()` was never executed. In normal execution, `JobMaster.cleanJob()` is responsible for calling `jobHistoryService.storeFinishedJobState(this)`. Because `cleanJob()` was never invoked, the job's terminal state is never persisted into `jobHistoryService`. 4. Furthermore, unlike `CoordinatorService.cancelJob(jobId)` (which has a defensive branch to store end state for pending jobs), `CoordinatorService.stopJob(jobId)` does not store the terminal state before the JobMaster is unregistered from `runningJobMasterMap`. 5. As a consequence, subsequent queries via `jobClient.getJobStatus(jobId)` or REST status API return `UNKNOWABLE` instead of `CANCELED`. The job history records are empty for this job ID, and any client CompletableFuture waiting on `jobClient.waitForJobComplete(jobId)` never completes (hangs until timeout). **Expected behavior**: Force-stopping a `PENDING` job should cleanly record its `CANCELED` terminal state into `JobHistoryService`, return `JobStatus.CANCELED` to status queries, and resolve completion futures. **Call for Contribution**: Welcome community contributors to claim and submit a PR to fix this issue! ### SeaTunnel Version 2.3.x, dev (commit af812b0) ### SeaTunnel Config ```conf env { job.mode = "STREAMING" checkpoint.interval = 5000 } source { FakeSource { result_table_name = "fake" row.num = 100 schema = { fields { id = "int" name = "string" } } } } sink { Console { source_table_name = "fake" } } ``` ### Running Command ```shell # Configure Zeta seatunnel.yaml with schedule_strategy: WAIT and slot-num: 2 # 1. Start a job consuming all slots # 2. Submit a second job (enters PENDING) # 3. Call JobClient.cancelJob(secondJobId, true) # 4. Call JobClient.getJobStatus(secondJobId) ``` ### Error Exception ```log Job status returns UNKNOWABLE instead of CANCELED: JobResult status: UNKNOWABLE JobHistoryService finished terminal job state is null for jobId. ``` ### Zeta or Flink or Spark Version Zeta (SeaTunnel Engine) ### Java or Scala Version Java 8 / Java 11 / Java 17 ### Screenshots _No response_ ### Are you willing to submit PR? - [ ] 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]
