You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "DanielLeens (via GitHub)" <gi...@apache.org> on 2026/09/07 04:16:34 UTC

[I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

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

   ## What Problem Does This Issue Report?
   
   `TaskExecutionService.deployLocalTask` can leave a stuck `TaskGroupLocation` permanently un-redeployable after a task-submission failure that happens right after context publication - discovered while reviewing #11727 and #11757, but the affected code is pre-existing baseline logic, not introduced by either.
   
   ## Root Cause
   
   `deployLocalTask` (`seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/TaskExecutionService.java`) does this inside `synchronized (this)`:
   
   ```java
   executionContexts.put(taskGroup.getTaskGroupLocation(), context);
   cancellationFutures.put(taskGroup.getTaskGroupLocation(), cancellationFuture);
   contextPublished = true;
   ```
   
   then, **outside** the lock: `onContextPublished.run()`, `submitThreadShareTask(...)`, `submitBlockingTask(...)`. The surrounding `catch (Throwable t)` only calls `onFailureBeforeContextPublished.accept(t)` `if (!contextPublished)` - which is always false by the time any of those three calls can throw (e.g. `RejectedExecutionException` from an executor mid-shutdown during a failover/restore window). So a throw there leaves the `executionContexts`/`cancellationFutures` entries in place with no rollback.
   
   That leak compounds with the guard in `deployTask`:
   
   ```java
   if (executionContexts.containsKey(taskGroup.getTaskGroupLocation())) {
       // "TaskGroupLocation %s already exists and is active, skipping redeploy ..."
       return TaskDeployState.success();
   }
   ```
   
   Once the leaked entry exists, every future redeploy attempt for that exact `TaskGroupLocation` hits this branch and returns success **without deploying anything** - a silent, permanent job hang rather than a visible failure.
   
   ## Suggested Fix
   
   Add a rollback path (remove both map entries) that also runs when `onContextPublished`/`submitThreadShareTask`/`submitBlockingTask` throw after `contextPublished` is set, matching the existing `!contextPublished` branch's cleanup semantics.
   
   ## Where This Was Found
   
   Confirmed present, unmodified by either PR's own diff, on both apache/seatunnel#11727 (`fix/11679-blockingworker-start-latch`, head `18e821c3d`) and apache/seatunnel#11757 (`fix-11755-stale-context-race`, head `39312b92d`), and matches current `dev`. Originally flagged as part of a broader review by @SEZ9 on #11727.
   


-- 
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: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "Rangsh (via GitHub)" <gi...@apache.org>.
Rangsh commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5612322230

   @SEZ9 Thanks — the four review asks are already spelled out in the PR description checklist on https://github.com/apache/seatunnel/pull/12218 (rollback boundary, deterministic failure injection + real second deploy, master-failover skip preservation, and scope on current `dev`).
   
   A follow-up commit also landed there to address DanielLeens' recommended Issue 2 (`CooperativeTaskWorker` null/isCancel guard symmetric with `BlockingWorker`). Remaining discussion will stay on the PR as you suggested.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "Rangsh (via GitHub)" <gi...@apache.org>.
Rangsh commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5629064467

   @SEZ9 Follow-up for the both-sides regression coverage is on #12218 (fee6db3b3). Continuing the discussion there as suggested.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5611672397

   Thanks @Rangsh, and nice work turning this around quickly. I have seen the PR link (https://github.com/apache/seatunnel/pull/12218) and will review it as my next step; I have not gone through the diff yet, so I am not making any statement about its contents or CI here.
   
   To make that review fast, a few concrete asks on the PR itself, all within the scope we agreed on in this thread:
   
   1. **Rollback boundary**: please call out in the PR description exactly where the new cleanup runs relative to context publication, `onContextPublished`, and task submission, so I can confirm a failure at the callback/submission boundary removes both the `executionContexts` entry and the associated `cancellationFutures` state, and that the pre-publication cleanup path is unchanged.
   2. **Regression test determinism**: please note how the post-publication failure is injected (i.e. that it is a deterministic hook rather than timing-based), and confirm the test asserts the second `deployTask` for the same `TaskGroupLocation` actually executes rather than merely returning success.
   3. **Master-failover preservation**: please confirm the test for the "already active, healthy task returns success without redeploy" case exercises the existing guard as-is, with no change to its semantics.
   4. **Scope**: please confirm the PR touches only `TaskExecutionService` and its test coverage, with no executor or classloader lifecycle changes, and that it is based on current `dev` (I last checked at `f6ed9579c5e`).
   
   Nothing further is needed from you on this issue itself; I will move the remaining discussion to the PR once I have reviewed it.
   
   <!-- streview-comment:924 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "Rangsh (via GitHub)" <gi...@apache.org>.
Rangsh commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5594360692

   @DanielLeens @SEZ9
   
   I’ve completed the narrow rollback fix as discussed, including the deterministic regression test that injects a post-publication failure and verifies:
   
   - published `executionContexts` / `cancellationFutures` do not leak
   - a subsequent `deployTask` for the same `TaskGroupLocation` actually redeploys and executes
   - the existing master-failover skip behavior for an already active healthy task is preserved
   
   PR: https://github.com/apache/seatunnel/pull/12218
   
   Please take a look when you have time. Thanks!


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "Rangsh (via GitHub)" <gi...@apache.org>.
Rangsh commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5570121605

   @DanielLeens Hey! I'd love to take this issue and work on it. Could you please assign it to me?


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "Rangsh (via GitHub)" <gi...@apache.org>.
Rangsh commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5578445615

   @SEZ9 Sounds good, thanks! I'll add the test as described. Please assign the issue to me to avoid duplicate work. Appreciate it!


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5578014994

   Thanks for the detailed analysis, @DanielLeens. The gap you describe is plausible: the `catch (Throwable t)` only runs cleanup when `!contextPublished`, so an exception from `onContextPublished`, `submitThreadShareTask`, or `submitBlockingTask` (e.g. a `RejectedExecutionException` from an executor shutting down during failover) would leave stale `executionContexts`/`cancellationFutures` entries and make every later redeploy for that `TaskGroupLocation` hit the skip branch. A rollback that removes both map entries on the post-publish failure path sounds like the right fix.
   
   @Rangsh, thanks for volunteering to pick this up. When you open a PR, it would be great to include a test that injects a throwing executor after context publication and asserts that a subsequent `deployTask` for the same `TaskGroupLocation` actually redeploys, so the fix is covered against regressions.
   
   <!-- streview-comment:876 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "Rangsh (via GitHub)" <gi...@apache.org>.
Rangsh commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5585443557

   @DanielLeens Thank you for the detailed guidance and for accepting the claim. I understand the assignee limitation and will proceed without expecting a formal assignment.
   
   I’ll prepare a narrow rollback fix as requested, with deterministic regression coverage that injects a failure after publication — including the callback/submission boundary — and verifies that the published context and associated cancellation state do not leak, and that a second deployment of the same TaskGroupLocation actually executes. I’ll also preserve the existing master-failover behavior where an already active, healthy task returns success rather than being redeployed, and I will avoid any unrelated executor or classloader lifecycle changes.
   
   I’ll keep the PR focused and submit it once ready. Thanks again for the clear direction.


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5584883373

   Thanks @Rangsh. I rechecked current `dev` (`f6ed9579c5e`) and found no matching open PR or later `TaskExecutionService` change. The post-publication failure boundary remains real: `executionContexts` is populated before `onContextPublished` and task submission, while the catch path only invokes the supplied failure cleanup before context publication. A failure after publication can therefore leave the location looking active and suppress a later redeploy.
   
   Your claim is accepted. GitHub does not recognize `Rangsh` as an assignable `apache/seatunnel` assignee, so I have deliberately left the formal assignee and labels unchanged rather than pretending the assignment succeeded. Please make the first PR a narrow rollback fix with deterministic regression coverage that injects a failure after publication (including the callback/submission boundary), proves that the published context and associated cancellation state do not leak, and proves that a second deployment of the same `TaskGroupLocation` actually executes. Preserve the existing master-failover behavior in which an already active, healthy task returns success rather than being redeployed. Do not broaden this into unrelated executor or classloader lifecycle 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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5642785396

   Thanks @Rangsh — acknowledged. Noted that the both-sides regression coverage landed on #12218 in `fee6db3b3`, and that the four review asks from the PR description checklist (rollback boundary, deterministic post-publication failure injection with a real second `deployTask` of the same `TaskGroupLocation`, master-failover skip preservation for an already active healthy task, and scope kept to current `dev`) are what that follow-up is meant to close out.
   
   Agreed that the remaining discussion stays on the PR. Nothing further is needed from you on this issue thread; I'll review `fee6db3b3` on #12218 against those four points and leave any comments there. One small ask when you get a chance: on the PR, please point to which test(s) cover the "both sides" of the boundary (the callback side and the submission side) so the reviewers can map the coverage to the checklist quickly.
   
   <!-- streview-comment:974 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug][Zeta] TaskExecutionService.deployLocalTask can permanently block redeploy after a post-publish task-submission failure [seatunnel]

Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on issue #12164:
URL: https://github.com/apache/seatunnel/issues/12164#issuecomment-5628386826

   @Rangsh Thanks — acknowledged that the four asks (rollback boundary, deterministic post-publication failure injection with a real second `deployTask` of the same `TaskGroupLocation`, master-failover skip preservation, and scope against current `dev` / `f6ed9579c5e`) are tracked in the checklist on https://github.com/apache/seatunnel/pull/12218, and that the `CooperativeTaskWorker` guard follow-up is there as well.
   
   One point I'd still like to see covered on the PR: please make sure the regression test exercises both sides of the post-publication boundary raised earlier — a failure from `onContextPublished` and a failure at task submission — and asserts for each that `executionContexts` / `cancellationFutures` are cleared and that the follow-up deployment actually executes rather than just returning success.
   
   I agree the rest of the discussion belongs on the PR; I'll pick up the review there. Thanks for the quick turnaround.
   
   <!-- streview-comment:951 -->


-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org