apache/dolphinscheduler · warning · TaskException
The current yarn task has been interrupted
Error message
The current yarn task has been interrupted
What it means
AbstractYarnTask.handle catches InterruptedException while waiting for the shell process that launches the Yarn application, sets the exit code to failure, and rethrows as TaskException with this message. It means the thread blocked on the task process was interrupted, typically by a kill/cancel or worker shutdown.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractYarnTask.java:62
// todo split handle to submit and track
@Override
public void handle(TaskCallBack taskCallBack) throws TaskException {
try {
IShellInterceptorBuilder shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
.properties(ParameterUtils.convert(taskRequest.getPrepareParamsMap()))
// todo: do we need to move the replace to subclass?
.appendScript(getScript().replaceAll("\\r\\n", System.lineSeparator()));
// SHELL task exit code
TaskResponse response = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);
setExitStatusCode(response.getExitStatusCode());
// set appIds
setAppIds(String.join(TaskConstants.COMMA, getApplicationIds()));
setProcessId(response.getProcessId());
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
log.info("The current yarn task has been interrupted", ex);
setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
throw new TaskException("The current yarn task has been interrupted", ex);
} catch (Exception e) {
log.error("yarn process failure", e);
exitStatusCode = -1;
throw new TaskException("Execute task failed", e);
}
}
// todo
@Override
public void submitApplication() throws TaskException {
}
// todo
@Override
public void trackApplicationStatus() throws TaskException {
}View on GitHub (pinned to 02eac45a1b)
Solutions
- Treat as expected when you cancelled the task yourself
- Check worker logs for shutdown/kill events around the interruption time
- Re-run the workflow/task after the interruption cause is resolved
- Ensure Hadoop/YARN application state is cleaned up (check for orphaned applications)
- If spurious, investigate what interrupts the task thread (executor shutdown, watchdog)
Defensive patterns
Strategy: try-catch
Try / catch
try {
yarnTask.handle(taskCallBack);
} catch (TaskException e) {
if (e.getCause() instanceof InterruptedException) {
log.warn("Yarn task was interrupted (cancelled or worker shutdown)");
// restore cleanup state, check YARN for orphaned applications
} else {
throw e;
}
} Prevention
- Avoid killing workflows while Yarn jobs are in a critical phase
- Plan worker shutdowns outside of in-flight task windows
- Always check YARN for orphaned applications after interruption
- Rely on EXIT_CODE_FAILURE being set — do not retry blindly
When it happens
Trigger: Thread interrupted while response = runProcess()/waiting on the shell command for the Yarn job — user cancels the task in the UI, workflow is killed, or the worker is shutting down and interrupts task threads.
Common situations: Operator kills a stuck Yarn task; worker graceful shutdown interrupts in-flight tasks; master failover cancels running task threads; timeout-kill path interrupting the process wait.
Related errors
- Cancel application failed!
- Execute task failed
- cancel application error
- The current ChunJun Task has been interrupted
- Track dinkyTask failed:
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/4282f0a73a8f4b9b.
Report an issue: GitHub.