xh123637 opened a new pull request, #13326:
URL: https://github.com/apache/seatunnel/pull/13326

   ### Purpose of this pull request
   
   Fixes #13316.
   
   If `JobMaster.cleanJob()` throws, `jobMasterCompleteFuture` is never 
completed and `JobMaster.run()` blocks forever in its `finally` block on 
`jobMasterCompleteFuture.join()`, leaking the coordinator thread and hanging 
clients waiting for job completion.
   
   The failure chain (`JobMaster.initStateFuture`):
   
   1. The job-status callback runs `cleanJob()` and then 
`jobMasterCompleteFuture.complete(jobResult)` inside Hazelcast's 
log-and-swallow `withTryCatch`.
   2. `cleanJob()` performs checkpoint-storage deletes and job-history IMap 
writes, all of which can throw (IO errors, 
`HazelcastInstanceNotActiveException` during shutdown, storage backend outage).
   3. When `cleanJob()` throws, `complete(...)` is skipped and the exception is 
only logged by `withTryCatch`, so the completion future stays incomplete 
forever.
   
   ### Change
   
   In `JobMaster.initStateFuture()`, wrap `cleanJob()` in a try/catch/finally:
   
   - A cleanup failure is logged as a warning (with the job id and the 
exception) instead of being silently swallowed.
   - `jobMasterCompleteFuture.complete(jobResult)` now runs in the `finally` 
block, so it completes unconditionally and `run()` can no longer hang on 
`join()`.
   
   The success path is unchanged: when cleanup succeeds, the same `JobResult` 
is completed exactly as before. `cleanJob()` itself is untouched, so no other 
caller is affected.
   
   ### Test
   
   Added `testCleanJobFailureStillCompletesJobMasterFuture` to the existing 
`JobMasterTest` (no new test class):
   
   - It builds a `JobMaster` whose `cleanJob()` always throws, calls `init()` 
(which registers the completion callback via `initStateFuture()`), then 
completes the plan's job-end future via 
`PhysicalPlan.completeJobEndFuture(...)`.
   - It asserts that `getJobMasterCompleteFuture()` completes within 30 seconds 
with the expected job result.
   - Without this fix, the assertion fails: the `cleanJob()` failure is 
swallowed by `withTryCatch`, the future is never completed, and the await times 
out.
   
   ### Verification limits (please let CI be the arbiter)
   
   I could not run the build or the tests locally: this environment has no 
access to Maven Central, and the `JobMasterTest` Hazelcast harness requires 
local networking that is unavailable here, so `./mvnw spotless:apply` and 
`./mvnw test` could not be executed. The change was verified by careful code 
review instead:
   
   - `complete(jobResult)` is now unconditional (finally block) on both the 
success and failure paths.
   - The `run()` finally block's `join()` therefore always unblocks once the 
job reaches a terminal state.
   - Formatting was hand-checked to mirror the surrounding code (Google Java 
Format / AOSP style), but Spotless has not been run; please flag any formatting 
drift and I will fix it.
   
   ### Does this PR introduce any user-facing change?
   
   No. This is an internal reliability fix in the Zeta engine's job-completion 
path: a transient cleanup failure now degrades to a warning instead of hanging 
job completion. No configuration, API, or default behavior changes.
   


-- 
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]

Reply via email to