{"record":{"id":"8a0f699952f0bfbd","repo":"apache/dolphinscheduler","slug":"cancel-application-error-8a0f69","errorCode":null,"errorMessage":"cancel application error","messagePattern":"cancel application error","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java","lineNumber":126,"sourceCode":"    }\n\n    @Override\n    public void submitApplication() throws TaskException {\n\n    }\n\n    @Override\n    public void trackApplicationStatus() throws TaskException {\n\n    }\n\n    @Override\n    public void cancelApplication() throws TaskException {\n        // cancel process\n        try {\n            shellCommandExecutor.cancelApplication();\n        } catch (Exception e) {\n            throw new TaskException(\"cancel application error\", e);\n        }\n    }\n\n    private String buildCommand() throws Exception {\n\n        List<String> args = new ArrayList<>();\n        args.add(SEATUNNEL_BIN_DIR + seatunnelParameters.getStartupScript());\n        args.addAll(buildOptions());\n\n        String command = String.join(\" \", args);\n        log.info(\"SeaTunnel task command: {}\", command);\n\n        return command;\n    }\n\n    protected List<String> buildOptions() throws Exception {\n        List<String> args = new ArrayList<>();\n        args.add(CONFIG_OPTIONS);","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-seatunnel/src/main/java/org/apache/dolphinscheduler/plugin/task/seatunnel/SeatunnelTask.java#L108-L144","documentation":"SeatunnelTask.cancelApplication() delegates to shellCommandExecutor.cancelApplication() to kill the SeaTunnel process; any exception is rethrown as TaskException(\"cancel application error\", e). It means the underlying process kill (e.g. destroy of the shell process tree via kill process id) failed.","triggerScenarios":"shellCommandExecutor.cancelApplication() throws — the recorded process id is stale/dead, the OS denies the kill (permission), or the executor's internal state is inconsistent because the process already exited.","commonSituations":"Killing a task right as the SeaTunnel process finishes (race on PID), worker user lacking rights to signal the process (different owner), PDS-based executors on Windows/limited environments where process handles are unavailable.","solutions":["Check the chained cause: 'No such process' means the job already ended — safe to ignore and verify final status.","Ensure the worker user owns or can signal the SeaTunnel process (same OS user, no su/permission mismatch).","Retry the kill; for stuck JVM children use the kill process id logged by the task to kill manually.","If recurring on worker restarts, check that task PIDs are being tracked/persisted correctly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    task.cancelApplication();\n} catch (TaskException e) {\n    if (e.getCause() instanceof NoSuchProcessException || String.valueOf(e.getCause()).contains(\"No such process\")) {\n        log.info(\"SeaTunnel process already exited; cancel is a no-op\");\n    } else throw e;\n}","preventionTips":["Run workers under a single OS user so it can signal all child processes","Expect PID races when the job finishes at the same time as the kill","Record and inspect the kill PID in task logs for manual cleanup"],"tags":["seatunnel","cancel","process"],"backgroundTag":"process-kill-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}