SEPURI-SAI-KRISHNA opened a new issue, #13477:
URL: https://github.com/apache/seatunnel/issues/13477

   ### 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 a job is cancelled while a sink task is still opening, the sink task 
can stay in `SinkFlowLifeCycle.open()` for about a minute, and the pipeline 
stays CANCELING for that time.
   
   `open()` registers the sink with the pipeline's aggregated committer and 
waits for it (`registerCommitter()`, `.join()`). On the committer's node, 
`SinkRegisterOperation` retries `getTask(committerTaskID)` 30 times, 2 s apart, 
while it throws `TaskGroupContextNotFoundException`. If the cancel already 
ended the committer task group, every retry fails the same way, so the sink 
waits until the retries run out. `join()` does not react to the cancel's 
interrupt.
   
   `JobExecutionIT.cancelJobTest` failed with `ConditionTimeout` at line 147 
(20 s after the cancel) in 
[#13460](https://github.com/zhangshenghang/seatunnel/actions/runs/45743485095/job/139656103025)
 and 
[#13363](https://github.com/Mithilbatra/seatunnel/actions/runs/45390768139/job/138442318415),
 whose changes do not touch this path. In the #13460 log, the committer of 
pipeline 1 is interrupted at 03:14:19, the sink task of pipeline 1 is not, 
`SlowOperationDetector` reports `SinkRegisterOperation` at 03:14:29, and that 
sink task is only interrupted when the node shuts down at 03:14:39.
   
   Reproduced on dev `60e039a810` with the job of `cancelJobTest` (two 
FakeSources to LocalFile) on an in-process node: a new JVM and a new node per 
run, pinned to one CPU (`taskset -c 0`), cancel as soon as the job is RUNNING.
   
   | Build | Runs | Cancel still CANCELING after 25 s |
   |---|---|---|
   | dev | 5 | 2 |
   | `SinkRegisterOperation` stops retrying once the committer task group has 
ended | 7 | 0 (the case occurred in 3 of them) |
   
   Thread dump of a stuck run: the sink task is parked in 
`AbstractInvocationFuture.join` from `SinkFlowLifeCycle.registerCommitter` 
(from `open()`), and a generic operation thread sleeps in 
`RetryUtils.retryWithException` from `SinkRegisterOperation.runInternal`. 
Replacing `join()` with the interruptible `get()` alone was not enough: 1 of 6 
runs still waited, on the other pipeline.
   
   ### SeaTunnel Version
   
   dev (60e039a810)
   
   ### SeaTunnel Config
   
   ```conf
   The job of JobExecutionIT.cancelJobTest: 
streaming_fakesource_to_file_complex.conf in connector-seatunnel-e2e-base.
   ```
   
   ### Running Command
   
   ```shell
   In-process node (AbstractSeaTunnelServerTest), job submitted with startJob 
and cancelled with CoordinatorService.cancelJob as soon as it is RUNNING. Happy 
to share the probe.
   ```
   
   ### Error Exception
   
   ```log
   org.awaitility.core.ConditionTimeoutException: Assertion condition defined 
as a org.apache.seatunnel.engine.e2e.JobExecutionIT expected: <true> but was: 
<false> within 20 seconds.
        at 
org.apache.seatunnel.engine.e2e.JobExecutionIT.cancelJobTest(JobExecutionIT.java:147)
   WARN  SlowOperationDetector - Slow operation detected: 
org.apache.seatunnel.engine.server.task.operation.sink.SinkRegisterOperation
        at 
org.apache.seatunnel.common.utils.RetryUtils.retryWithException(RetryUtils.java:67)
        at 
org.apache.seatunnel.engine.server.task.operation.sink.SinkRegisterOperation.runInternal(SinkRegisterOperation.java:55)
   ```
   
   ### Zeta or Flink or Spark Version
   
   Zeta
   
   ### Java or Scala Version
   
   JDK 11 and 17 in CI, JDK 17 locally
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] 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]

Reply via email to