apache/dolphinscheduler · error · TaskException

The current HiveCLI Task has been interrupted

Error message

The current HiveCLI Task has been interrupted

What it means

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.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-hivecli/src/main/java/org/apache/dolphinscheduler/plugin/task/hivecli/HiveCliTask.java:102

        }
    }

    // todo split handle to submit and track
    @Override
    public void handle(TaskCallBack taskCallBack) throws TaskException {
        try {
            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()
                    .appendScript(buildCommand());
            final TaskResponse taskResponse = shellCommandExecutor.run(shellActuatorBuilder, taskCallBack);
            setExitStatusCode(taskResponse.getExitStatusCode());
            setAppIds(taskResponse.getAppIds());
            setProcessId(taskResponse.getProcessId());
            setTaskOutputParams(shellCommandExecutor.getTaskOutputParams());
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            log.error("The current HiveCLI Task has been interrupted", e);
            setExitStatusCode(EXIT_CODE_FAILURE);
            throw new TaskException("The current HiveCLI Task has been interrupted", e);
        } catch (Exception e) {
            log.error("hiveCli task failure", e);
            setExitStatusCode(EXIT_CODE_FAILURE);
            throw new TaskException("run hiveCli task error", e);
        }
    }

    @Override
    public void submitApplication() throws TaskException {

    }

    @Override
    public void trackApplicationStatus() throws TaskException {

    }

    protected String buildCommand() {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. If the interruption was intentional (cancel/kill), simply accept the failure; re-run the task if the query should complete.
  2. Increase the task/workflow timeout or optimize the Hive query so it finishes before cancellation windows.
  3. Check worker logs around the interrupt to confirm it came from an expected cancel/shutdown, not a spurious thread-pool kill.
  4. Ensure graceful-shutdown settings give workers time to let tasks finish before interrupts are issued.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    task.handle(taskCallBack);
} catch (TaskException e) {
    if (e.getCause() instanceof InterruptedException) {
        // task was cancelled/worker interrupted: mark as cancelled, do not retry blindly
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/52eebb9bc75a9776. Report an issue: GitHub.