Skip to content

[Fix-17786][SeaTunnel] Cancel Zeta jobs via seatunnel.sh -can - #18492

Open
richardmilles wants to merge 1 commit into
apache:devfrom
richardmilles:Fix-17786
Open

richardmilles wants to merge 1 commit into
apache:devfrom
richardmilles:Fix-17786

Conversation

@richardmilles

Copy link
Copy Markdown

Was this PR generated or assisted by AI?

Yes, assisted by AI.

Purpose of the pull request

Fixes #17786

Replaces #18469 (closed for missing PR template).

SeaTunnel Zeta streaming jobs are not cancelled after the client is killed, so tasks can keep running.

Brief change log

  • Parse Zeta jobId from SeaTunnel logs
  • Cancel jobs with seatunnel.sh -can <jobId> after client kill

Verify this pull request

This pull request is already covered by existing tests where available.

  • Manual: start a Zeta streaming SeaTunnel task, stop it, confirm the job is cancelled

Pull Request Notice

Pull Request Notice

If your pull request contains incompatible change, you should also add it to docs/docs/en/guide/upgrade/incompatible.md

Parse SeaTunnel Engine job id from logs and cancel the engine job after killing the local client process.
Comment on lines +171 to +176
for (String line : Files.readAllLines(Paths.get(logPath), StandardCharsets.UTF_8)) {
String jobId = findSeaTunnelJobId(line);
if (jobId != null) {
jobIds.add(jobId);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readAllLines method can OOM the worker.

findSeaTunnelJobIdsFromLog calls it after every Zeta task exits, batch or streaming, success or failure. Streaming tasks are exactly the target of this PR and run for weeks; the client prints a job-progress table every 60s by default, local deploy mode dumps all engine logs to stdout, and Console sinks print every row. A multi-hundred-MB log becomes several times that on the heap. The worker runs with a 4g default heap and -XX:+ExitOnOutOfMemoryError, so one such task takes down the worker and every task on it. DS's own precedent for the same job, LogUtils.getAppIdsFromLogFile, streams with Files.lines.

Minimum fix: stream line by line and stop at the first match. Better fix: capture the id from the stdout stream while the task runs instead of re-reading the file at all.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [SeaTunnel] SeaTunnel streaming job status incorrect & task cannot be stopped from DolphinScheduler

2 participants