{"record":{"id":"b632fd810fd972b7","repo":"apache/dolphinscheduler","slug":"cancel-application-error-b632fd","errorCode":null,"errorMessage":"cancel application error","messagePattern":"cancel application error","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-dvc/src/main/java/org/apache/dolphinscheduler/plugin/task/dvc/DvcTask.java","lineNumber":89,"sourceCode":"        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            log.error(\"The current DvcTask has been interrupted\", e);\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            throw new TaskException(\"The current DvcTask has been interrupted\", e);\n        } catch (Exception e) {\n            log.error(\"dvc task error\", e);\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            throw new TaskException(\"Execute dvc task failed\", e);\n        }\n    }\n\n    @Override\n    public void cancel() throws TaskException {\n        // cancel process\n        try {\n            shellCommandExecutor.cancelApplication();\n        } catch (Exception e) {\n            throw new TaskException(\"cancel application error\", e);\n        }\n    }\n\n    public String buildCommand() {\n        String command = \"\";\n        String taskType = parameters.getDvcTaskType();\n        if (taskType.equals(DvcConstants.DVC_TASK_TYPE.UPLOAD)) {\n            command = buildUploadCommond();\n        } else if (taskType.equals(DvcConstants.DVC_TASK_TYPE.DOWNLOAD)) {\n            command = buildDownCommond();\n        } else if (taskType.equals(DvcConstants.DVC_TASK_TYPE.INIT)) {\n            command = buildInitDvcCommond();\n        }\n        log.info(\"Run DVC task with command: \\n{}\", command);\n        return command;\n    }\n\n    private String buildUploadCommond() {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-dvc/src/main/java/org/apache/dolphinscheduler/plugin/task/dvc/DvcTask.java#L71-L107","documentation":"DvcTask.cancel delegates to shellCommandExecutor.cancelApplication(), which kills the running dvc/git process. Any exception during cancellation (process already exited, kill signal fails, IO error) is wrapped as TaskException 'cancel application error'.","triggerScenarios":"cancel() invoked by the worker when the task is being stopped/killed and shellCommandExecutor.cancelApplication() throws — e.g. the process ID is stale because the process already terminated, or the kill/cleanup operations raise an IO exception.","commonSituations":"Race between the subprocess finishing and the cancel request arriving; permission problems sending signals to the child process; worker-level process cleanup issues after abnormal shell executor state.","solutions":["Usually harmless during a kill: confirm the dvc process actually terminated (ps) and simply re-run the task.","Check the wrapped cause for signal/IO specifics; if 'No such process', the process already exited and no action is needed.","Ensure the worker user owns the spawned processes so signals are permitted.","Upgrade DolphinScheduler if cancel races are frequent — later versions hardened ShellCommandExecutor cleanup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    dvcTask.cancel();\n} catch (TaskException e) {\n    log.warn(\"cancel raced with process exit; verifying process is gone\", e); // safe if 'No such process'\n}","preventionTips":["Treat cancel errors during kill as best-effort; verify the child process is terminated afterwards.","Run workers so the worker user owns the spawned dvc/git processes.","Keep ShellCommandExecutor updated to benefit from hardened cleanup.","Don't cancel twice in quick succession."],"tags":["cancel","process-kill","dvc","shell","worker"],"backgroundTag":"process-termination-failed","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"}