apache/dolphinscheduler · error · TaskException
cancel application error
Error message
cancel application error
What it means
DataxTask.cancel() delegates cancellation of the running DataX shell process to ShellCommandExecutor.cancelApplication(). If that call throws for any reason (process already dead, kill failure, interrupted), the exception is wrapped in a TaskException with the message 'cancel application error'. It signals that the worker could not cleanly stop the DataX job process.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java:169
} catch (Exception e) {
log.error("datax task error", e);
setExitStatusCode(EXIT_CODE_FAILURE);
throw new TaskException("Execute DataX task failed", e);
}
}
/**
* cancel DataX process
*
* @throws TaskException if error throws Exception
*/
@Override
public void cancel() throws TaskException {
// cancel process
try {
shellCommandExecutor.cancelApplication();
} catch (Exception e) {
throw new TaskException("cancel application error", e);
}
}
/**
* Reads the DataX job definition from the designated json resource file. The worker has
* already downloaded resources into the execution directory by the time the task runs.
*/
private String readJsonFromResourceFile(ResourceInfo jobResource) throws Exception {
String resourceFileName = jobResource.getResourceName();
ResourceContext resourceContext = taskRequest.getResourceContext();
return FileUtils.readFileToString(
new File(resourceContext.getResourceItem(resourceFileName).getResourceAbsolutePathInLocal()),
StandardCharsets.UTF_8);
}
/**
* build datax configuration file
*View on GitHub (pinned to 02eac45a1b)
Solutions
- Check worker logs for the wrapped cause to see why the kill failed (process already gone vs. permission vs. interrupted).
- If caused by an already-exited process, treat as benign and rely on the process exit code recorded by the executor.
- Ensure the worker OS user has permission to kill the DataX child processes (same user, sufficient ulimits).
- Retry cancellation or force-kill leftover DataX processes manually (pkill -f datax).
Example fix
// before
try {
shellCommandExecutor.cancelApplication();
} catch (Exception e) {
throw new TaskException("cancel application error", e);
}
// after
try {
shellCommandExecutor.cancelApplication();
} catch (Exception e) {
log.warn("cancel application error (process may have already exited)", e);
throw new TaskException("cancel application error", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
// no pre-call check possible; ensure process is alive before cancelling boolean cancellable = task.getProcessId() > 0;
Try / catch
try {
task.cancel();
} catch (TaskException e) {
log.warn("DataX task cancel failed (may have already exited): {}", e.getCause());
} Prevention
- Run worker and DataX processes under the same OS user so kills succeed.
- Check process exit status before treating a cancel failure as fatal.
- Monitor for zombie DataX processes after cancel failures.
When it happens
Trigger: Calling cancel() on a DataxTask while shellCommandExecutor.cancelApplication() throws — e.g. the underlying process handle is stale, the OS kill command fails, or the cancel is interrupted.
Common situations: Killing a running DataX task from the UI; worker shutdown/cancel during task execution; task process already exited concurrently so cancel races with process termination.
Related errors
- Cannot find the logic task factory: ${taskType}
- The default branch is empty, please check the switch task co
- Execute task failed
- Failed to get Kubernetes application status
- Execute k8s task error
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/21e2ed553ba12592.
Report an issue: GitHub.