{"record":{"id":"3a022524c62b86e1","repo":"apache/dolphinscheduler","slug":"task-execution-time-out","errorCode":null,"errorMessage":"task execution time out","messagePattern":"task execution time out","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java","lineNumber":256,"sourceCode":"            }\n            taskOutputParams = taskOutputParameterParser.getTaskOutputParams();\n        }, collectProcessLogService);\n\n        collectProcessLogService.shutdown();\n        return collectProcessLogFuture;\n    }\n\n    /**\n     * get remain time（s）\n     *\n     * @return remain time\n     */\n    private long getRemainTime() {\n        long usedTime = (System.currentTimeMillis() - taskRequest.getStartTime()) / 1000;\n        long remainTime = taskRequest.getTaskTimeout() - usedTime;\n\n        if (remainTime < 0) {\n            throw new RuntimeException(\"task execution time out\");\n        }\n\n        return remainTime;\n    }\n\n    /**\n     * get process id\n     *\n     * @param process process\n     * @return process id\n     */\n    private int getProcessId(Process process) {\n        int processId = 0;\n\n        try {\n            Field f = process.getClass().getDeclaredField(TaskConstants.PID);\n            f.setAccessible(true);\n","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java#L238-L274","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Increase the task's timeout value (and timeout strategy) in the workflow definition","Optimize the command/job so it completes within the timeout","Split the work into smaller tasks or use a dependency-based workflow","Check why the command is slow (resource contention, data volume)","If the task truly has no bound, raise timeoutFactor / use a very large timeout"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before submitting, sanity check the configured timeout\nif (taskTimeoutSeconds <= 0 || taskTimeoutSeconds < estimatedRunTimeSeconds) {\n    throw new IllegalArgumentException(\"Task timeout too small: \" + taskTimeoutSeconds);\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.handle(...);\n} catch (TaskException | RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"task execution time out\")) {\n        log.warn(\"Task exceeded its timeout budget; increase timeout or optimize the job\");\n    } else {\n        throw e;\n    }\n}","preventionTips":["Set realistic timeouts based on measured job runtimes","Use timeoutFactor > 1 for variable workloads","Split long jobs into smaller tasks","Alert on tasks approaching their timeout before the watchdog fires"],"tags":["timeout","watchdog","shell-execution"],"backgroundTag":"request-timeout","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"}