zhangshenghang opened a new issue, #13319:
URL: https://github.com/apache/seatunnel/issues/13319

   ### What happened
   
   With `seatunnel.engine.task.execution.thread-share-mode = all` (or PART for 
opting-in tasks), a single task `init()` failure throws an NPE from 
`threadShareTaskQueue.add(null)`, leaves the task-group context permanently 
stuck, and then blocks redeployment — the job hangs with no further progress 
and the real error is masked.
   
   Chain (dev @ 89f91a89af):
   
   1. `TaskExecutionService.submitThreadShareTask` 
(`TaskExecutionService.java:370-393`): the guard 
`!executionCompletedExceptionally()` is evaluated **once**, before `forEach` 
consumes the stream. A task whose `init()` fails mid-stream returns `null` from 
the mapper (its own catch records the exception and calls `taskDone` for 
itself), so `threadShareTaskQueue.add(null)` throws NPE (`threadShareTaskQueue` 
is a `LinkedBlockingDeque`, `TaskExecutionService.java:170`).
   2. `deployLocalTask` publishes `executionContexts` **before** submitting 
tasks (`TaskExecutionService.java:715-731`) and its catch only completes the 
`resultFuture` exceptionally — **the published context is never removed**. 
`completionLatch` is initialized to the full task count 
(`TaskExecutionService.java:1531`), and the tasks never submitted never call 
`taskDone`, so the latch never reaches zero and `finishExecution` never runs.
   3. When the master restarts the pipeline and re-deploys, `deployTask` sees 
the location still present in `executionContexts` and returns success without 
deploying ("already exists and is active, skipping redeploy", 
`TaskExecutionService.java:535-555`). The vertex is marked RUNNING but the dead 
context never reports a terminal state — the job hangs forever, and the visible 
error is an NPE instead of the real init failure.
   
   ### Trigger
   
   Any single task init failure in thread-share mode (or a cancellation landing 
mid-stream).
   
   ### Impact
   
   Job hangs with no progress; worker-side context/classloader leak; misleading 
NPE in logs. Default mode (`OFF`) is unaffected.
   
   ### Suggested fix
   
   Filter nulls before `add`; on submit failure, tear the context down (count 
down the remaining latch / remove the context / report FAILED for the group) so 
`finishExecution` runs and a terminal status reaches the master.
   
   ### SeaTunnel Version
   
   dev (89f91a89af), Zeta engine
   


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