apache/dolphinscheduler · error · TaskException

cancel application error

Error message

cancel application error

What it means

JupyterTask.cancelApplication() wraps any exception from shellCommandExecutor.cancelApplication() (which kills the spawned jupyter process) into TaskException 'cancel application error'. It fires during task cancellation when the underlying process handle cannot be signalled or destroyed.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java:225

        }

        String others = jupyterParameters.getOthers();
        if (StringUtils.isNotEmpty(others)) {
            args.add(others);
        }

        args.add(JupyterConstants.INJECT_PATHS);
        args.add(JupyterConstants.PROGRESS_BAR);
        return args;
    }

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

    @Override
    public AbstractParameters getParameters() {
        return jupyterParameters;
    }

}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the wrapped stack trace; if the process already exited the cancel race is benign and can be retried/ignored.
  2. Verify the worker user can signal child processes (especially in Docker/Kubernetes containers).
  3. Check for orphaned jupyter/nbconvert processes on the worker and kill them manually.
  4. Upgrade to a version where cancelApplication handles already-dead processes gracefully.

Example fix

// before
} catch (Exception e) {
    throw new TaskException("cancel application error", e);
}
// after
} catch (Exception e) {
    log.warn("failed to cancel jupyter application, process may already be dead", e);
    throw new TaskException("cancel application error: " + e.getMessage(), e);
}
Defensive patterns

Strategy: try-catch

Type guard

static boolean isBenignCancelError(TaskException e) {
    Throwable c = e.getCause();
    return c != null && (c.getMessage() != null && c.getMessage().contains("No such process"));
}

Try / catch

try {
    jupyterTask.cancelApplication();
} catch (TaskException e) {
    if (isBenignCancelError(e)) {
        log.info("process already terminated; cancel is a no-op");
    } else {
        log.warn("failed to cancel jupyter process", e);
    }
}

Prevention

When it happens

Trigger: Task is being killed and shellCommandExecutor.cancelApplication() throws — process already exited, PID no longer exists, OS permission denial sending the kill signal, or an internal executor exception during cancel.

Common situations: Killing a task whose jupyter process already finished (race), worker user lacking permission to kill a process started under another user/container, zombie processes, or OS-level restrictions in containers without SIGKILL capability.

Related errors


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