From 603dfa2e4b38215afec05444789f09328507d48d Mon Sep 17 00:00:00 2001 From: Wenjun Ruan Date: Wed, 17 Jan 2024 10:24:41 +0800 Subject: [PATCH] Fix notify failover WorkflowInstance will cause NPE (#15499) --- .../server/master/runner/WorkflowExecuteRunnable.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java index 012cc8149a..b558d6cf37 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java @@ -490,6 +490,16 @@ public class WorkflowExecuteRunnable implements IWorkflowExecuteRunnable { } else { ProcessInstance processInstance = processService.findProcessInstanceById(nextTaskInstance.getProcessInstanceId()); + if (processInstance == null) { + log.error("WorkflowInstance is null cannot wakeup, processInstanceId:{}", + nextTaskInstance.getProcessInstanceId()); + return; + } + if (processInstance.getHost() == null || Constants.NULL.equals(processInstance.getHost())) { + log.warn("The next WorkflowInstance: {} host is null no need to wakeup, maybe it is in failover", + processInstance); + return; + } ILogicTaskInstanceOperator taskInstanceOperator = SingletonJdkDynamicRpcClientProxyFactory .getProxyClient(processInstance.getHost(), ILogicTaskInstanceOperator.class); taskInstanceOperator.wakeupTaskInstance(