{"record":{"id":"591b55b82e4394de","repo":"apache/dolphinscheduler","slug":"cancel-this-procedure-task-failed","errorCode":null,"errorMessage":"Cancel this procedure task failed","messagePattern":"Cancel this procedure task failed","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java","lineNumber":153,"sourceCode":"                return;\n            }\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            log.error(\"Failed to execute this procedure task\", e);\n            throw new TaskException(\"Execute procedure task failed\", e);\n        }\n    }\n\n    @Override\n    public void cancel() throws TaskException {\n        if (sessionStatement != null) {\n            try {\n                log.info(\"Try to cancel this procedure task\");\n                sessionStatement.cancel();\n                setExitStatusCode(TaskConstants.EXIT_CODE_KILL);\n                log.info(\"This procedure task was canceled\");\n            } catch (Exception ex) {\n                log.warn(\"Failed to cancel this procedure task\", ex);\n                throw new TaskException(\"Cancel this procedure task failed\", ex);\n            }\n        } else {\n            log.info(\n                    \"Attempted to cancel this procedure task, but no active statement exists. Possible reasons: task not started, already completed, or canceled.\");\n        }\n    }\n\n    // parse the out parameter from stmt and put them into varPool\n    private Map<String, String> parseOutParameters(CallableStatement stmt,\n                                                   Map<Integer, Property> sqlOutPlaceHolders) throws SQLException {\n        Map<String, String> sqlOutParameters = new HashMap<>();\n        for (Map.Entry<Integer, Property> out : sqlOutPlaceHolders.entrySet()) {\n            int index = out.getKey();\n            Property property = out.getValue();\n            String prop = property.getProp();\n            DataType dataType = property.getType();\n            // get output parameter\n            Object outputParameterValue = getOutputParameter(stmt, index, prop, dataType);","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}