apache/dolphinscheduler · error · TaskException
Cancel this procedure task failed
Error message
Cancel this procedure task failed
What it means
Statement.cancel() on the live JDBC session threw while trying to stop the running stored procedure — the connection may already be closed/broken, the driver may not support cancel, or the DB rejected the cancel. A cancellation-path failure only: the task was being killed and the JDBC cancel itself failed; wrapping in TaskException preserves the cause.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java:153
return;
}
setExitStatusCode(EXIT_CODE_FAILURE);
log.error("Failed to execute this procedure task", e);
throw new TaskException("Execute procedure task failed", e);
}
}
@Override
public void cancel() throws TaskException {
if (sessionStatement != null) {
try {
log.info("Try to cancel this procedure task");
sessionStatement.cancel();
setExitStatusCode(TaskConstants.EXIT_CODE_KILL);
log.info("This procedure task was canceled");
} catch (Exception ex) {
log.warn("Failed to cancel this procedure task", ex);
throw new TaskException("Cancel this procedure task failed", ex);
}
} else {
log.info(
"Attempted to cancel this procedure task, but no active statement exists. Possible reasons: task not started, already completed, or canceled.");
}
}
// parse the out parameter from stmt and put them into varPool
private Map<String, String> parseOutParameters(CallableStatement stmt,
Map<Integer, Property> sqlOutPlaceHolders) throws SQLException {
Map<String, String> sqlOutParameters = new HashMap<>();
for (Map.Entry<Integer, Property> out : sqlOutPlaceHolders.entrySet()) {
int index = out.getKey();
Property property = out.getValue();
String prop = property.getProp();
DataType dataType = property.getType();
// get output parameter
Object outputParameterValue = getOutputParameter(stmt, index, prop, dataType);View on GitHub (pinned to 02eac45a1b)
Solutions
- Inspect the caused-by SQLException; if the connection is already dead the cancel is moot
- Kill the underlying DB session from the database side if JDBC cancel fails
- Check driver support for Statement.cancel with the target database
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java:153 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/591b55b82e4394de.
Report an issue: GitHub.