{"record":{"id":"1ab5e4d664efe047","repo":"apache/dolphinscheduler","slug":"dispatch-task-taskname-to-physicalta-1ab5e4","errorCode":null,"errorMessage":"\"Dispatch task: \" + taskName + \" to \" + physicalTaskExecutorAddress + \" failed\"","messagePattern":"\"Dispatch task: \" \\+ taskName \\+ \" to \" \\+ physicalTaskExecutorAddress \\+ \" failed\"","errorType":"exception","errorClass":"TaskDispatchException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/client/PhysicalTaskExecutorClientDelegator.java","lineNumber":98,"sourceCode":"                .orElseThrow(() -> new NoAvailableWorkerException(workerGroup));\n\n        taskExecutionContext.setHost(physicalTaskExecutorAddress);\n        taskExecution.getTaskInstance().setHost(physicalTaskExecutorAddress);\n\n        try {\n            final TaskExecutorDispatchResponse taskExecutorDispatchResponse = Clients\n                    .withService(IPhysicalTaskExecutorOperator.class)\n                    .withHost(physicalTaskExecutorAddress)\n                    .dispatchTask(TaskExecutorDispatchRequest.of(taskExecution.getTaskExecutionContext()));\n            if (!taskExecutorDispatchResponse.isDispatchSuccess()) {\n                throw new TaskDispatchException(\n                        \"Dispatch task: \" + taskName + \" to \" + physicalTaskExecutorAddress + \" failed: \"\n                                + taskExecutorDispatchResponse);\n            }\n        } catch (TaskDispatchException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new TaskDispatchException(\n                    \"Dispatch task: \" + taskName + \" to \" + physicalTaskExecutorAddress + \" failed\", e);\n        }\n    }\n\n    @Override\n    public boolean reassignMasterHost(final ITaskExecution taskExecution) {\n        final String taskName = taskExecution.getName();\n        checkArgument(taskExecution.isTaskInstanceInitialized(),\n                \"Task \" + taskName + \"is not initialized cannot take-over\");\n\n        final TaskInstance taskInstance = taskExecution.getTaskInstance();\n        final String taskExecutorHost = taskInstance.getHost();\n        if (StringUtils.isEmpty(taskExecutorHost)) {\n            log.debug(\n                    \"The task executor: {} host is empty, cannot take-over, this might caused by the task hasn't dispatched\",\n                    taskName);\n            return false;\n        }","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/client/PhysicalTaskExecutorClientDelegator.java#L80-L116","documentation":"A generic wrapper: any exception thrown while sending the dispatch RPC to the selected worker (network error, timeout, serialization failure, unexpected runtime exception) is rethrown as TaskDispatchException with message 'Dispatch task: <name> to <address> failed' and the original exception as the cause. The dispatch never got a usable response from the worker.","triggerScenarios":"Any Exception other than TaskDispatchException escaping the Clients...dispatchTask call in PhysicalTaskExecutorClientDelegator.dispatch — e.g. connection refused/reset, RPC timeout, unmarshalling error — caught by the catch (Exception e) block.","commonSituations":"Worker process crashed or was restarted mid-dispatch; firewall/network partition between master and worker; wrong host:port advertised by the worker in the registry; RPC timeout because the worker is saturated.","solutions":["Inspect the caused-by exception in the log to identify the transport failure (connection refused vs timeout vs unmarshal)","Check the target worker at the address in the message: is it running, reachable, and registered with the correct host:port?","Verify network/firewall rules allow master->worker RPC on the worker's listen port","Retry the task; if a specific worker is persistently bad, remove it from the group or fix its advertised address"],"exampleFix":"// before\n// raw RPC exception bubbles as generic TaskDispatchException\n// after\n// validate reachability before dispatch\nif (!isWorkerReachable(physicalTaskExecutorAddress)) {\n    throw new NoAvailableWorkerException(workerGroup);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    taskExecutorClient.dispatch(taskExecution);\n} catch (TaskDispatchException e) {\n    Throwable cause = e.getCause();\n    log.error(\"Dispatch transport failure to {}: {}\", cause, e.getMessage());\n    // if cause is a connectivity error, mark the worker unhealthy and retry on another worker\n}","preventionTips":["Monitor master<->worker connectivity (ports, firewalls) continuously","Ensure workers advertise the correct host:port in the registry","Set sane RPC timeouts and worker saturation limits","Use retry/failover so a single dead worker does not fail the workflow"],"tags":["rpc","network","worker","task-dispatch"],"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-14T00:17:10.932Z"}