{"record":{"id":"3b5d6305feb0bc06","repo":"apache/dolphinscheduler","slug":"the-current-linkis-task-has-been-interrupted","errorCode":null,"errorMessage":"The current Linkis task has been interrupted","messagePattern":"The current Linkis task has been interrupted","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-linkis/src/main/java/org/apache/dolphinscheduler/plugin/task/linkis/LinkisTask.java","lineNumber":95,"sourceCode":"    }\n\n    @Override\n    public void submitApplication() throws TaskException {\n        try {\n            // construct process\n            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()\n                    .properties(ParameterUtils.convert(taskRequest.getPrepareParamsMap()))\n                    .appendScript(buildCommand());\n            TaskResponse commandExecuteResult = shellCommandExecutor.run(shellActuatorBuilder, null);\n            setExitStatusCode(commandExecuteResult.getExitStatusCode());\n            setAppIds(findTaskId(commandExecuteResult.getResultString()));\n            setProcessId(commandExecuteResult.getProcessId());\n            linkisParameters.dealOutParam(shellCommandExecutor.getTaskOutputParams());\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            log.error(\"The current Linkis task has been interrupted\", e);\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            throw new TaskException(\"The current Linkis task has been interrupted\", e);\n        } catch (Exception e) {\n            log.error(\"Linkis task error\", e);\n            setExitStatusCode(EXIT_CODE_FAILURE);\n            throw new TaskException(\"Execute Linkis task failed\", e);\n        }\n    }\n\n    @Override\n    public void trackApplicationStatus() throws TaskException {\n        initTaskId();\n        try {\n            List<String> args = new ArrayList<>();\n            args.add(Constants.SHELL_CLI_OPTIONS);\n            args.add(Constants.STATUS_OPTIONS);\n            args.add(taskId);\n            String command = String.join(Constants.SPACE, args);\n            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()\n                    .appendScript(command);","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-linkis/src/main/java/org/apache/dolphinscheduler/plugin/task/linkis/LinkisTask.java#L77-L113","documentation":"While submitApplication() runs the Linkis job through ShellCommandExecutor, an InterruptedException means the worker thread executing the task was interrupted (workflow kill/stop or worker shutdown). The code restores the interrupt flag, logs it, sets exit status to failure, and rethrows as TaskException.","triggerScenarios":"Thread.interrupt() is called on the task thread while shellCommandExecutor is executing the Linkis command — typically a kill of the task/workflow instance, or worker graceful shutdown during command execution.","commonSituations":"User stops/kills the workflow instance while the Linkis job runs; worker node is shutting down; a kill-timeout watchdog interrupts the executing thread.","solutions":["If the kill was intentional, no action needed — task exits with EXIT_CODE_FAILURE and is reported as failed/killed.","Check workflow execution history to confirm who triggered the kill; review the attached stack trace.","If unexpected, inspect worker logs for shutdown or watchdog events at that time.","Rerun the workflow once the worker is stable; ensure Linkis job resubmission is safe."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    task.submitApplication();\n} catch (TaskException e) {\n    if (Thread.currentThread().isInterrupted()) {\n        // treat as kill/shutdown: do not retry\n    }\n}","preventionTips":["Avoid killing workers mid-submission; drain tasks first.","Set kill timeouts larger than expected submission duration.","Monitor worker shutdown logs to distinguish intentional kills.","Make Linkis job submission idempotent for safe retries."],"tags":["interruption","linkis","shell-executor","thread"],"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-14T00:17:10.932Z"}