{"record":{"id":"7185737d4fa28122","repo":"apache/dolphinscheduler","slug":"kill-task-taskexecution-getname-from-e","errorCode":null,"errorMessage":"\"Kill task: \" + taskExecution.getName() + \" from executor failed\"","messagePattern":"\"Kill task: \" \\+ taskExecution\\.getName\\(\\) \\+ \" from executor failed\"","errorType":"exception","errorClass":"TaskKillException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/client/TaskExecutorClient.java","lineNumber":90,"sourceCode":"        }\n    }\n\n    @Override\n    public void pause(final ITaskExecution taskExecution) throws TaskPauseException {\n        try {\n            getTaskExecutorClientDelegator(taskExecution).pause(taskExecution);\n        } catch (Exception ex) {\n            throw new TaskPauseException(\"Pause task: \" + taskExecution.getName() + \" from executor failed\",\n                    ex);\n        }\n    }\n\n    @Override\n    public void kill(final ITaskExecution taskExecution) throws TaskKillException {\n        try {\n            getTaskExecutorClientDelegator(taskExecution).kill(taskExecution);\n        } catch (Exception ex) {\n            throw new TaskKillException(\"Kill task: \" + taskExecution.getName() + \" from executor failed\", ex);\n        }\n    }\n\n    @Override\n    public void ackTaskExecutorLifecycleEvent(\n                                              final ITaskExecution taskExecution,\n                                              final ITaskExecutorLifecycleEventReporter.TaskExecutorLifecycleEventAck taskExecutorLifecycleEventAck) {\n        try {\n            if (StringUtils.isEmpty(taskExecution.getTaskInstance().getHost())) {\n                log.info(\"The task: {} is didn't dispatched to executor, skip ack taskExecutorLifecycleEventAck: {}\",\n                        taskExecution.getName(), taskExecutorLifecycleEventAck);\n                return;\n            }\n            getTaskExecutorClientDelegator(taskExecution)\n                    .ackTaskExecutorLifecycleEvent(taskExecution, taskExecutorLifecycleEventAck);\n        } catch (Exception ex) {\n            log.error(\"Send taskExecutorLifecycleEventAck: {} failed\", taskExecutorLifecycleEventAck, ex);\n        }","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/client/TaskExecutorClient.java#L72-L108","documentation":"Thrown as TaskKillException when a kill request for a task cannot be completed on its executor. TaskExecutorClient.kill delegates to the executor client delegator; any exception in the RPC is wrapped with the task name. It means the master could not force-stop the task remotely.","triggerScenarios":"Calling kill(ITaskExecution) when the executor is unreachable, the RPC throws (timeout, connection refused), or the delegator errors while forwarding the kill.","commonSituations":"User kills a workflow while the worker hosting the task is down; task process is in uninterruptible state; master-worker network split; worker restarted and the task registry entry is stale.","solutions":["Check the wrapped cause to distinguish network failure from executor-side kill failure.","Confirm the worker is alive; if it crashed, the task instance can be marked as killed/failed manually via failover.","Retry the kill; if the process is orphaned on the host, clean it up manually on the worker machine.","Verify worker-group addresses and network paths between master and worker."],"exampleFix":"// before\ntry { client.kill(taskExecution); } catch (Exception e) { /* swallowed */ }\n\n// after\ntry {\n    client.kill(taskExecution);\n} catch (TaskKillException e) {\n    log.error(\"Kill of task {} failed, cause: {}\", taskExecution.getName(), e.getCause().getMessage());\n    taskExecution.getTaskInstance().setState(TaskExecutionStatus.FAILURE);\n}","handlingStrategy":"try-catch","validationCode":"// confirm the task host is still registered\nboolean workerAlive = registryClient.checkNodeExists(taskExecution.getHost(), NodeType.WORKER);\nif (!workerAlive) {\n    log.warn(\"Worker down; mark task {} failed instead of killing\", taskExecution.getName());\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.kill(taskExecution);\n} catch (TaskKillException e) {\n    log.error(\"Kill of {} failed, cause: {}\", taskExecution.getName(), e.getCause().getMessage());\n    // mark task as failed or orphan-cleanup on the worker host\n}","preventionTips":["Check worker liveness before killing; handle crashed-worker tasks via failover instead.","Clean up orphaned task processes on worker hosts after failed kills.","Keep master-worker connectivity monitored to reduce kill RPC failures."],"tags":["kill","rpc","task-executor","network"],"backgroundTag":"network-request-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}