apache/dolphinscheduler · error · TaskException
K8sTask is timeout
Error message
K8sTask is timeout
What it means
AbstractK8sTaskExecutor.waitTimeout(Boolean) throws TaskException("K8sJobExecutor is timeout") — here "K8sTask is timeout" — when the caller passes timeout=TRUE, i.e. the K8s task exceeded its configured timeout while waiting for the job to finish. It is the library's way of aborting a job that did not reach completion in time.
Source
Thrown at dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/k8s/AbstractK8sTaskExecutor.java:57
this.taskRequest = taskRequest;
this.k8sUtils = new K8sUtils();
this.yaml = new Yaml(new ClassFilterConstructor(new Class[]{
List.class,
String.class
}));
this.taskOutputParams = new HashMap<>();
}
public Map<String, String> getTaskOutputParams() {
return taskOutputParams;
}
public abstract TaskResponse run(String k8sParameterStr) throws Exception;
public abstract void cancelApplication(String k8sParameterStr);
public void waitTimeout(Boolean timeout) throws TaskException {
if (Boolean.TRUE.equals(timeout)) {
throw new TaskException("K8sTask is timeout");
}
}
public abstract void submitJob2k8s(String k8sParameterStr);
public abstract void stopJobOnK8s(String k8sParameterStr);
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Increase the task's timeout setting in the task/workflow definition to exceed realistic job runtime.
- Check why the job is slow: pod logs, image pull time, Pending pods due to insufficient cluster resources.
- If the job legitimately runs long, split it or raise timeouts and resource limits.
- Ensure failed timed-out jobs are cleaned up (stopJobOnK8s/cancelApplication) to avoid orphaned jobs.
Example fix
// before timeout = 60; // seconds, too small for the job // after timeout = 3600; // sized to worst-case job runtime, incl. image pull
Defensive patterns
Strategy: validation
Validate before calling
long estimatedRuntimeMs = estimateJobRuntime();
if (taskTimeoutMs <= estimatedRuntimeMs) {
log.warn("Task timeout ({}) is close to/below expected runtime ({})", taskTimeoutMs, estimatedRuntimeMs);
} Try / catch
try {
response = executor.run(k8sParameterStr);
} catch (TaskException e) {
if (e.getMessage() != null && e.getMessage().contains("timeout")) {
log.warn("K8s job exceeded timeout; cleaning up job and retrying with larger timeout");
executor.cancelApplication(k8sParameterStr);
}
throw e;
} Prevention
- Size the task timeout to worst-case runtime including image pull and scheduling wait.
- Alert on pods stuck in Pending — resource starvation commonly eats the timeout budget.
- Clean up jobs on timeout (cancelApplication/stopJobOnK8s) to avoid orphaned resources.
When it happens
Trigger: The polling/watch loop in the concrete executor (K8sTaskExecutor.run) detects elapsed time >= taskTimeout and calls waitTimeout(true), or the task definition's timeout is smaller than the job's actual runtime.
Common situations: Long-running container images (big data jobs) with default/short timeout; slow image pulls consuming the budget; cluster resource starvation making pods Pending; timeout configured in the wrong unit.
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.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Failed to get Kubernetes application status
- Execute k8s task error
- namespace %s does not exist in k8s cluster, please create na
- fail to get k8s ApiClient:%s
- K8S_NAMESPACE_EXIST
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/c4142bf2bbcb5a99.
Report an issue: GitHub.