[Bug] [SeaTunnel] SeaTunnel streaming job status incorrect & task cannot be stopped from DolphinScheduler
Search before asking
- [x] I had searched in the issues and found no similar issues.
What happened
version: 3.2.2
When running a SeaTunnel MySQL-CDC streaming job through DolphinScheduler, the task status shown in DolphinScheduler UI is incorrect, and the “Stop” action does not actually terminate the running SeaTunnel job.
This causes DolphinScheduler to report the workflow as “Stopped”, while the SeaTunnel job continues running in the background.
What you expected to happen
Expected behavior
DolphinScheduler should display the correct runtime status of a streaming task.
When clicking Stop, DolphinScheduler should send the appropriate stop/kill command to SeaTunnel so the job is actually terminated.
Task status in DolphinScheduler and SeaTunnel should remain consistent.
Actual behavior
DolphinScheduler shows the task as Executing or Started workflow, even though the SeaTunnel job is already running normally.
Clicking Stop in DolphinScheduler does not terminate the SeaTunnel job.
SeaTunnel UI still shows the job in RUNNING state.
DolphinScheduler UI incorrectly reports the task as Stopped, leading to mismatch between DS and SeaTunnel.
How to reproduce
Screenshots
dolphin webui:
seatunnel webui:
Anything else
No response
Version
3.2.x
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
Has the latest version of DolphinScheduler fixed these two issues?
Has the latest version of DolphinScheduler fixed these two issues?
AFAIK, this has not been fixed.
I conducted a simple test using ds 3.3.1 and seatunnel 2.3.11. After manually stopping the cdc task on ds, I checked the task status through./bin/seatunnel.sh -l and webui. Both were CANCELED, indicating that the cdc task could be terminated normally.
/bin/seatunnel.sh-l
ds web
seatunnel web
@Mrhs121 Thank you for providing this important information. I have further examined the implementation of the SeatunnelTask plugin in DS. Currently, we submit tasks using a seatunnel client process, and when canceling, we directly stop the process. By default, seatunnel will close the job if the seatunnel client process is closed, see -cj option.
https://seatunnel.apache.org/docs/2.3.12/seatunnel-engine/user-command
@cyrusmaster Please check if there exist any error in DS worker server when you close SeatunnelTask in DS, and check if the seatunnel client process has been killed.
Have you tried 3.2.2 and have this problem? @Mrhs121
I tried to switch the cancellationApplication() method implementation in SeatunnelTask in 3.3.1 and 3.2.2. In the old version 3.3.1, process.destroy() and process.destroyForcibly() were used, but in 3.3.2, it was changed to ProcessUtils.kill(). Is it because of this fix? @ruanwenjun
Comparison screenshots:
@cyrusmaster That should be the reason, still need to check the log. This change is imported by https://github.com/apache/dolphinscheduler/pull/17005
There are two fix PR https://github.com/apache/dolphinscheduler/pull/17320 https://github.com/apache/dolphinscheduler/issues/17776
I tried to switch the cancellationApplication() method implementation in SeatunnelTask in 3.3.1 and 3.2.2. In the old version 3.3.1, process.destroy() and process.destroyForcibly() were used, but in 3.3.2, it was changed to ProcessUtils.kill(). Is it because of this fix? @ruanwenjun
Comparison screenshots:
I also conducted a simple test using 3.3.2, and it worked normally to close the cdc task. At the same time, I also tested it with version 3.2.2 and found that the cdc task couldn't be closed normally.
I discovered that in version 3.2.2, ds stops the task through kill -9. When kill -9 is used, only the parent process may be killed. Due to the limited propagation of the SIGKILL signal, the cdc job child process may become an orphan process.
After 3.3.x, tasks are stopped using kill -15, thus the SIGTERM signal will be passed to the entire process group.
It seems that we can only upgrade the version to 3.3.1? @Mrhs121
It seems that we can only upgrade the version to 3.3.1? @Mrhs121
FYI, mabay you can modify the code of version 3.2.2 like this and then try to see if it can stop the seatunnle cdc task normally
There are two main reasons for this issue.
- seatunnel did not detect the orphan process.
- ds did not kill the subprocess recursively.
So what DS can do is to optimize the killing logic and kill the subprocess tree recursively.
I've been digging into this issue and found the root cause. Here's what's going on:
The SeatunnelTask isn't properly tracking streaming jobs because a few key methods are missing or incomplete:
getApplicationIds()just returns an empty list, so DS never gets the actual Yarn/K8s application IDtrackApplicationStatus()does nothing - there's no status polling happening- When you hit "Stop", it only kills the local shell process, but the SeaTunnel job keeps running on the cluster
For the fix, I see two options:
Quick fix - implement the missing methods in SeatunnelTask:
- Parse the application ID from log output (like FlinkTask/SparkTask already do)
- Use that ID to properly cancel the job when stopping
- Add status polling so the UI shows the correct state
Bigger refactor - make SeatunnelTask extend AbstractYarnTask instead of AbstractRemoteTask. This would give us the tracking behavior automatically but it's a more significant change.
Before I start coding, would be good to know:
- Quick fix vs refactor - any preference?
- Anything special about the Flink/Spark/Zeta modes I should watch out for?
- Is Yarn/K8s polling sufficient or should we also consider SeaTunnel's REST API?
I'm happy to put together a PR once we settle on an approach. Thoughts?
I've been digging into this issue and found the root cause. Here's what's going on:
The
SeatunnelTaskisn't properly tracking streaming jobs because a few key methods are missing or incomplete:
getApplicationIds()just returns an empty list, so DS never gets the actual Yarn/K8s application IDtrackApplicationStatus()does nothing - there's no status polling happening- When you hit "Stop", it only kills the local shell process, but the SeaTunnel job keeps running on the cluster
For the fix, I see two options:
Quick fix - implement the missing methods in
SeatunnelTask:
- Parse the application ID from log output (like FlinkTask/SparkTask already do)
- Use that ID to properly cancel the job when stopping
- Add status polling so the UI shows the correct state
Bigger refactor - make
SeatunnelTaskextendAbstractYarnTaskinstead ofAbstractRemoteTask. This would give us the tracking behavior automatically but it's a more significant change.Before I start coding, would be good to know:
- Quick fix vs refactor - any preference?
- Anything special about the Flink/Spark/Zeta modes I should watch out for?
- Is Yarn/K8s polling sufficient or should we also consider SeaTunnel's REST API?
I'm happy to put together a PR once we settle on an approach. Thoughts?
I'm wondering if Seatunel has a unified implementation of a Zeta like stop command for Flink and Spark, ensuring consistency in the DS implementation. If Seatunel doesn't have a plan, then the stop functionality for various Flink and Spark modes needs to be covered in the DS implementation.
I'd like to take a narrow fix for the SeaTunnel Engine (Zeta) path in this issue.
Plan (one PR, scoped to Zeta/seatunnel.sh):
- Parse SeaTunnel job id from worker logs (
job id: <id>from SeaTunnel client submit logs) - On cancel: keep process-tree kill, then also run
seatunnel.sh -can <jobId>so cluster/streaming jobs are actually canceled when killing the client alone is not enough
Flink/Spark engine Yarn cancel and full status polling stay out of this PR.
