apache/dolphinscheduler · warning · TaskException

cancel application error

Error message

cancel application error

What it means

cancelApplication wraps any exception from shellCommandExecutor.cancelApplication() into TaskException('cancel application error'). The attempt to kill the underlying shell process / Yarn application failed.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractYarnTask.java:93

    // todo
    @Override
    public void trackApplicationStatus() throws TaskException {

    }

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

    /**
     * get application ids
     * @return
     * @throws TaskException
     */
    @Override
    public List<String> getApplicationIds() throws TaskException {
        return LogUtils.getAppIds(taskRequest.getLogPath(), taskRequest.getAppInfoPath(),
                PropertyUtils.getString(APPID_COLLECT, DEFAULT_COLLECT_WAY));
    }

    /**
     * Get the script used to bootstrap the task
     */
    protected abstract String getScript();

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check the wrapped cause; 'no such process' races are harmless and can be ignored
  2. Verify worker kill configuration (sudo permissions for the tenant user / KillProcessID)
  3. Ensure shellCommandExecutor state is intact (worker didn't restart mid-task)
  4. Clean up orphaned YARN applications manually if the OS kill failed
  5. Retry cancellation or use YARN kill application for the running app
Defensive patterns

Strategy: try-catch

Try / catch

try {
    task.cancelApplication();
} catch (TaskException e) {
    if (e.getCause() != null && e.getCause().getMessage() != null
            && e.getCause().getMessage().contains("No such process")) {
        log.info("Process already exited; cancel is a no-op");
    } else {
        log.warn("Cancel failed, verify no orphaned YARN application", e);
    }
}

Prevention

When it happens

Trigger: shellCommandExecutor.cancelApplication() throws while killing the process tree — the process already exited, the kill command (kill/pkill, sudo) fails, or an IO error occurs.

Common situations: User cancels a task whose process already terminated (race); worker lacks permission to kill the process owner's processes (non-root sudo config); PID file lost after worker restart.

Related errors


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