apache/dolphinscheduler · warning · TaskException

cancel application error

Error message

cancel application error

What it means

DvcTask.cancel delegates to shellCommandExecutor.cancelApplication(), which kills the running dvc/git process. Any exception during cancellation (process already exited, kill signal fails, IO error) is wrapped as TaskException 'cancel application error'.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-dvc/src/main/java/org/apache/dolphinscheduler/plugin/task/dvc/DvcTask.java:89

        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.error("The current DvcTask has been interrupted", e);
            setExitStatusCode(EXIT_CODE_FAILURE);
            throw new TaskException("The current DvcTask has been interrupted", e);
        } catch (Exception e) {
            log.error("dvc task error", e);
            setExitStatusCode(EXIT_CODE_FAILURE);
            throw new TaskException("Execute dvc task failed", e);
        }
    }

    @Override
    public void cancel() throws TaskException {
        // cancel process
        try {
            shellCommandExecutor.cancelApplication();
        } catch (Exception e) {
            throw new TaskException("cancel application error", e);
        }
    }

    public String buildCommand() {
        String command = "";
        String taskType = parameters.getDvcTaskType();
        if (taskType.equals(DvcConstants.DVC_TASK_TYPE.UPLOAD)) {
            command = buildUploadCommond();
        } else if (taskType.equals(DvcConstants.DVC_TASK_TYPE.DOWNLOAD)) {
            command = buildDownCommond();
        } else if (taskType.equals(DvcConstants.DVC_TASK_TYPE.INIT)) {
            command = buildInitDvcCommond();
        }
        log.info("Run DVC task with command: \n{}", command);
        return command;
    }

    private String buildUploadCommond() {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Usually harmless during a kill: confirm the dvc process actually terminated (ps) and simply re-run the task.
  2. Check the wrapped cause for signal/IO specifics; if 'No such process', the process already exited and no action is needed.
  3. Ensure the worker user owns the spawned processes so signals are permitted.
  4. Upgrade DolphinScheduler if cancel races are frequent — later versions hardened ShellCommandExecutor cleanup.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    dvcTask.cancel();
} catch (TaskException e) {
    log.warn("cancel raced with process exit; verifying process is gone", e); // safe if 'No such process'
}

Prevention

When it happens

Trigger: cancel() invoked by the worker when the task is being stopped/killed and shellCommandExecutor.cancelApplication() throws — e.g. the process ID is stale because the process already terminated, or the kill/cleanup operations raise an IO exception.

Common situations: Race between the subprocess finishing and the cancel request arriving; permission problems sending signals to the child process; worker-level process cleanup issues after abnormal shell executor state.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/b632fd810fd972b7. Report an issue: GitHub.