apache/dolphinscheduler · warning · RuntimeException

task execution time out

Error message

task execution time out

What it means

getRemainTime computes taskTimeout minus elapsed seconds and throws this RuntimeException when the budget is exhausted. It is the shell-process watchdog enforcing the user-configured task timeout, stopping a run that has exceeded its allowed time.

Source

Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java:256

            }
            taskOutputParams = taskOutputParameterParser.getTaskOutputParams();
        }, collectProcessLogService);

        collectProcessLogService.shutdown();
        return collectProcessLogFuture;
    }

    /**
     * get remain time(s)
     *
     * @return remain time
     */
    private long getRemainTime() {
        long usedTime = (System.currentTimeMillis() - taskRequest.getStartTime()) / 1000;
        long remainTime = taskRequest.getTaskTimeout() - usedTime;

        if (remainTime < 0) {
            throw new RuntimeException("task execution time out");
        }

        return remainTime;
    }

    /**
     * get process id
     *
     * @param process process
     * @return process id
     */
    private int getProcessId(Process process) {
        int processId = 0;

        try {
            Field f = process.getClass().getDeclaredField(TaskConstants.PID);
            f.setAccessible(true);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Increase the task's timeout value (and timeout strategy) in the workflow definition
  2. Optimize the command/job so it completes within the timeout
  3. Split the work into smaller tasks or use a dependency-based workflow
  4. Check why the command is slow (resource contention, data volume)
  5. If the task truly has no bound, raise timeoutFactor / use a very large timeout
Defensive patterns

Strategy: validation

Validate before calling

// before submitting, sanity check the configured timeout
if (taskTimeoutSeconds <= 0 || taskTimeoutSeconds < estimatedRunTimeSeconds) {
    throw new IllegalArgumentException("Task timeout too small: " + taskTimeoutSeconds);
}

Try / catch

try {
    task.handle(...);
} catch (TaskException | RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("task execution time out")) {
        log.warn("Task exceeded its timeout budget; increase timeout or optimize the job");
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: System.currentTimeMillis() - startTime exceeds taskRequest.getTaskTimeout() while the process is still running — the command runs longer than the task's timeout setting (timeoutFactor/timeout in seconds).

Common situations: Long-running shell/Hive/Spark job exceeding the configured timeout; timeout set too low (or default) for a heavy job; worker under load slowing the command; timeoutFactor configured to 1 with a conservative timeout.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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