{"record":{"id":"52eebb9bc75a9776","repo":"apache/dolphinscheduler","slug":"the-current-hivecli-task-has-been-interrupted","errorCode":null,"errorMessage":"The current HiveCLI Task has been interrupted","messagePattern":"The current HiveCLI Task has been interrupted","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java","lineNumber":102,"sourceCode":"        }\n    }\n\n    // todo split handle to submit and track\n    @Override\n    public void handle(TaskCallBack taskCallBack) throws TaskException {\n        try {\n            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()\n                    .appendScript(buildCommand());\n            final TaskResponse taskResponse = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);\n            setExitStatusCode(taskResponse.getExitStatusCode());\n            setAppIds(taskResponse.getAppIds());\n            setProcessId(taskResponse.getProcessId());\n            setTaskOutputParams(shellCommandExecutor.getTaskOutputParams());\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            log.error(\"The current HiveCLI Task has been interrupted\", e);\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            throw new TaskException(\"The current HiveCLI Task has been interrupted\", e);\n        } catch (Exception e) {\n            log.error(\"hiveCli task failure\", e);\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            throw new TaskException(\"run hiveCli task error\", e);\n        }\n    }\n\n    @Override\n    public void submitApplication() throws TaskException {\n\n    }\n\n    @Override\n    public void trackApplicationStatus() throws TaskException {\n\n    }\n\n    protected String buildCommand() {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java#L84-L120","documentation":"HiveCliTask.handle() runs the hive CLI via ShellCommandExecutor.run(), which blocks on the subprocess. If the worker thread waiting on the process is interrupted (task cancel/kill or worker shutdown), the InterruptedException is caught, the interrupt flag is restored, exit status is set to failure, and a TaskException('The current HiveCLI Task has been interrupted') is thrown.","triggerScenarios":"User clicks kill/stop on the running HiveCLI task instance; the worker shuts down or the task's thread-pool is interrupted while ShellCommandExecutor.run() is waiting on the hive process; timeout-based cancellation interrupts the executing thread.","commonSituations":"Long-running hive queries killed by an operator or by scheduler timeout; worker restart/redeploy while a HiveCLI task was in progress; workflow-level stop cascading an interrupt to the task thread.","solutions":["If the interruption was intentional (cancel/kill), simply accept the failure; re-run the task if the query should complete.","Increase the task/workflow timeout or optimize the Hive query so it finishes before cancellation windows.","Check worker logs around the interrupt to confirm it came from an expected cancel/shutdown, not a spurious thread-pool kill.","Ensure graceful-shutdown settings give workers time to let tasks finish before interrupts are issued."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    task.handle(taskCallBack);\n} catch (TaskException e) {\n    if (e.getCause() instanceof InterruptedException) {\n        // task was cancelled/worker interrupted: mark as cancelled, do not retry blindly\n    }\n}","preventionTips":["Avoid killing the task instance unless cancellation is intended; a re-run is required after interruption","Set realistic timeouts so long hive queries are not interrupted mid-run","Coordinate worker shutdowns with the scheduler's graceful-drain window","Check task instance state after interruption before retrying to avoid duplicate hive executions"],"tags":["hivecli","interruption","task-cancelled","process-execution"],"backgroundTag":"task-thread-interrupted","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}