Repository navigation
Description
Search before asking
- I searched existing issues. The closest reports are [Bug] [seatunnel-server] job state is always canceling #8168 and [Bug] [Checkoint] checkpoint fail in 2.3.6 #7339; both were closed as stale without a fix.
What happened
When a task group is canceled, its BlockingWorker can retain or receive an interrupt while it is finishing. The last task calls TaskExecutionService.TaskGroupExecutionTracker#taskDone(), which synchronously invokes updateMetricsContextInImap() on that interrupted worker before completing the task-group future.
If the final metrics write reaches Hazelcast while the thread is interrupted, the socket write can throw ClosedByInterruptException. Java NIO closes the channel in that case, so a best-effort final metrics update can close the worker's shared connection to a live master. Because this update runs before the terminal future is completed, cancellation can also remain stuck or time out.
The current dev branch still has the synchronous call in taskDone(). Periodic metrics updates already run on a separate scheduled executor, but the final update does not.
Issue #8168 contains the same production sequence: a canceled BlockingWorker enters taskDone(), updateMetricsContextInImap() throws ClosedByInterruptException, and the shared Hazelcast connection closes. Issue #7339 reports the same interrupted-Hazelcast-write mechanism from a checkpoint path. Both issues were closed by the stale bot.
How to reproduce
A deterministic two-member test can reproduce the failure without mocking Hazelcast networking:
- Start a master and worker and capture their existing Hazelcast connection.
- Run a controllable task on the worker.
- Cancel the task and inject a late interrupt into the original
BlockingWorkerwhen final metrics collection begins. - Wait for the task group to reach a terminal state and inspect the captured connection.
With the current implementation, the negative control throws ClosedByInterruptException, the captured connection closes, and cancellation exceeds a 10-second terminal-state deadline. Moving only the final metrics update to the existing task executor while preserving the wait-before-terminal ordering makes the test pass and keeps the original connection alive.
Expected behavior
Final metrics reporting should not perform Hazelcast I/O on an interrupted task worker. The task group should still wait for the final metrics attempt before publishing its terminal state, and metrics failures should remain best-effort without closing the worker-master connection.
Impact
- A normal cancellation path can close a healthy, shared Hazelcast member connection.
- The final metrics snapshot can be lost.
- Task-group cancellation can be delayed or remain in
CANCELING. - Other operations sharing the connection can be disrupted until reconnection.
Scope
This issue tracks only the final metrics call from TaskExecutionService#taskDone(). It does not claim to fix every interrupted Hazelcast write path or the separate worker-loss CANCELED/FAILED race.
I have a focused candidate patch with one unit regression test and one two-member regression test and can submit it as a separate PR.
Additional CI evidence
The Java 8 engine-v2-it job for #12265 at commit f716321a reproduced this exact path in GitHub Actions:
BlockingWorker -> TaskGroupExecutionTracker.taskDone() -> updateMetricsContextInImap() -> Hazelcast socket write -> ClosedByInterruptException -> member connection closed.
The full job is available at https://github.com/jjj-n/seatunnel/actions/runs/35554918326/job/106197992293. This evidence comes from code where the candidate fix was intentionally kept out of that PR, so it reproduces the current dev behavior independently of the coordinator lifecycle changes under review.
SeaTunnel version
Current dev (3.0.0-SNAPSHOT); the same stack was reported against 2.3.8 in #8168.
Java version
Reproduced with Java 8. The underlying ClosedByInterruptException behavior is part of Java NIO channel interruption semantics.
Activity
DanielLeens commentedon Sep 21, 2026
Classification: A / Zeta cancellation and final-metrics lifecycle.
I re-checked current
dev. When the last task completes,TaskGroupExecutionTracker.taskDone()callsfinishExecution(...)and then callsupdateMetricsContextInImap()synchronously before it completes the task-group future. That method creates a Hazelcast invocation and waits withinvoke.get(). Its interruption handling records the event and restores the interrupt flag, but it does not move the invocation away from the interruptedBlockingWorker.That confirms the lifecycle risk described here. PR #12265 is about coordinator admission/lifecycle isolation and does not change this path; I found no open focused PR for it.
A focused fix is welcome. It must keep the existing ordering that the terminal task-group result is published only after the final metrics attempt, but the attempt itself must run outside the cancelled worker. Please include the unit regression and the two-member case from this report: prove that a late interrupt cannot close the existing worker-master connection, that the terminal state still arrives within the asserted bound, and that a failed final metrics attempt remains best-effort. Please keep this separate from #12265 and link the PR here before starting so there is one implementation path.
[Fix][Zeta] Isolate final metrics reporting from task interrupts
[Fix][Zeta] Isolate final metrics reporting from task interrupts
[Fix][Zeta] Isolate final metrics reporting from task interrupts