apache/dolphinscheduler · warning · TaskException

The current ChunJun Task has been interrupted

Error message

The current ChunJun Task has been interrupted

What it means

ChunJunTask.handle() runs the ChunJun shell/submit command; when the waiting thread is interrupted it restores the interrupt flag, sets exit code to failure, and throws TaskException 'The current ChunJun Task has been interrupted'. This occurs when the task is killed/canceled by DolphinScheduler while the subprocess is running.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-chunjun/src/main/java/org/apache/dolphinscheduler/plugin/task/chunjun/ChunJunTask.java:102

    public void handle(TaskCallBack taskCallBack) throws TaskException {
        try {
            Map<String, Property> paramsMap = taskRequest.getPrepareParamsMap();

            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
                    .properties(ParameterUtils.convert(paramsMap))
                    .appendScript(buildCommand(buildChunJunJsonFile(paramsMap)));
            TaskResponse commandExecuteResult = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);

            setExitStatusCode(commandExecuteResult.getExitStatusCode());

            // todo get applicationId
            setAppIds(String.join(TaskConstants.COMMA, Collections.emptySet()));
            setProcessId(commandExecuteResult.getProcessId());
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.error("The current ChunJun Task has been interrupted", e);
            setExitStatusCode(EXIT_CODE_FAILURE);
            throw new TaskException("The current ChunJun Task has been interrupted", e);
        } catch (Exception e) {
            log.error("chunjun task failed.", e);
            setExitStatusCode(EXIT_CODE_FAILURE);
            throw new TaskException("Execute chunjun task failed", e);
        }
    }

    /**
     * build chunjun json file
     *
     * @param paramsMap
     * @return
     * @throws Exception
     */
    private String buildChunJunJsonFile(Map<String, Property> paramsMap) throws Exception {
        // generate json
        String fileName = String.format("%s/%s_job.json", taskRequest.getExecutePath(), taskRequest.getTaskAppId());

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. This is usually an intentional cancel — verify the task status in the UI and re-run if needed.
  2. Check Yarn/Flink job state to ensure the ChunJun process was actually terminated and clean up orphan jobs.
  3. Increase the task timeout if legitimate runs are being interrupted by the timeout policy.
  4. If workers are being restarted frequently, schedule graceful shutdowns outside task execution windows.
  5. Inspect worker logs just before the interruption for the originating cancel/kill event.

Example fix

// before
// task timeout: 3600s, ChunJun streaming job needs longer
<task timeout=3600 timeoutPolicy=KILL>
// after
<task timeout=86400 timeoutPolicy=FAILED>
// or use streaming-safe scheduling without aggressive kill
Defensive patterns

Strategy: try-catch

Validate before calling

// before submit
if (task.getTaskTimeout() < expectedJobDurationSeconds) {
    throw new IllegalStateException("timeout too short for chunjun job");
}

Try / catch

try {
    task.handle(callback);
} catch (TaskException e) {
    if (e.getMessage().contains("interrupted")) {
        log.warn("chunjun task cancelled; ensure yarn/flink job is killed", e);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling handle() and having the worker thread interrupted — user kills/cancels the workflow instance, the task times out and is cancelled, or the worker shuts down while ShellCommandExecutor is waiting for the ChunJun process.

Common situations: Users stop a long-running ChunJun (Flink batch/stream) job from the UI; task timeout policy triggers kill; worker graceful shutdown during deployment; process hangs (e.g. waiting on Yarn resources) and is force-cancelled.

Related errors


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