{"record":{"id":"0b79f237f8fdfdde","repo":"apache/dolphinscheduler","slug":"workflowinstance-s-stop-failed","errorCode":null,"errorMessage":"WorkflowInstance: %s stop failed","messagePattern":"WorkflowInstance: (.+?) stop failed","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecutorDelegate.java","lineNumber":107,"sourceCode":"    }\n\n    void stopInMaster(WorkflowInstance workflowInstance) {\n        try {\n            final WorkflowInstanceStopResponse stopResponse = Clients\n                    .withService(IWorkflowControlClient.class)\n                    .withHost(workflowInstance.getHost())\n                    .stopWorkflowInstance(new WorkflowInstanceStopRequest(workflowInstance.getId()));\n\n            if (stopResponse != null && stopResponse.isSuccess()) {\n                log.info(\"WorkflowInstance: {} stop success\", workflowInstance.getName());\n            } else {\n                throw new ServiceException(\n                        \"WorkflowInstance: \" + workflowInstance.getName() + \" stop failed: \" + stopResponse);\n            }\n        } catch (ServiceException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new ServiceException(\n                    String.format(\"WorkflowInstance: %s stop failed\", workflowInstance.getName()), e);\n        }\n    }\n\n    public static class StopWorkflowInstanceOperation {\n\n        private final StopWorkflowInstanceExecutorDelegate stopWorkflowInstanceExecutorDelegate;\n\n        private WorkflowInstance workflowInstance;\n\n        private User executeUser;\n\n        public StopWorkflowInstanceOperation(StopWorkflowInstanceExecutorDelegate stopWorkflowInstanceExecutorDelegate) {\n            this.stopWorkflowInstanceExecutorDelegate = stopWorkflowInstanceExecutorDelegate;\n        }\n\n        public StopWorkflowInstanceExecutorDelegate.StopWorkflowInstanceOperation onWorkflowInstance(WorkflowInstance workflowInstance) {\n            this.workflowInstance = workflowInstance;","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecutorDelegate.java#L89-L125","documentation":"Wrapping variant of the stop failure thrown by StopWorkflowInstanceExecutorDelegate.stopInMaster: any non-ServiceException exception during the RPC to the master (connection refused, timeout, host unreachable) is wrapped in a ServiceException with this message and the original exception as the cause. It means the stop request could not be completed due to a transport/communication problem rather than an explicit master rejection.","triggerScenarios":"Any Exception thrown while calling stopWorkflowInstance on workflowInstance.getHost(): connection refused (master down), RPC timeout, DNS/hostname resolution failure, serialization errors.","commonSituations":"Master process killed or crashed so the recorded host is unreachable; network partition between API and master; wrong host registered due to misconfigured advertise address; slow master causing RPC timeouts during heavy load.","solutions":["Check connectivity to workflowInstance.getHost() (ping/port) and confirm the master process is running","Inspect the wrapped cause exception for the transport-level error","Wait for master failover and retry the stop against the new host","Verify master advertise address/port configuration matches the registry entry","Check master logs and system resource usage if timeouts recur"],"exampleFix":"// before\nstopInMaster(instance); // throws wrapped ServiceException on connection failure\n// after\ntry {\n    stopInMaster(instance);\n} catch (ServiceException e) {\n    log.error(\"Stop failed for {}: {}\", instance.getName(), e.getCause(), e);\n    // check master health / retry or force-fail in DB\n}","handlingStrategy":"try-catch","validationCode":"try (Socket s = new Socket()) {\n    String[] hp = instance.getHost().split(\":\");\n    s.connect(new InetSocketAddress(hp[0], Integer.parseInt(hp[1])), 2000); // throws if unreachable\n}","typeGuard":null,"tryCatchPattern":"try {\n    delegate.execute(op);\n} catch (ServiceException e) {\n    Throwable cause = e.getCause();\n    log.error(\"Stop transport failure: {}\", cause == null ? e : cause.getMessage(), e);\n    // connectivity check, then retry or failover\n}","preventionTips":["Always inspect getCause() to distinguish network vs. application failure","Monitor master host reachability from the API server","Verify master advertise address/port configuration","Set sane RPC timeouts and retry policy"],"tags":["workflow","master-server","rpc","network"],"backgroundTag":"connection-refused","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"}