Browse Source

[Bug][Api] Fix NPE when deleting a workflow instance (#15485) (#15488)

sunsongyang 1 year ago
parent
commit
e1fcd4e485

+ 6 - 3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java

@@ -379,9 +379,12 @@ public class TaskInstanceServiceImpl extends BaseServiceImpl implements TaskInst
             return;
         }
         for (TaskInstance taskInstance : needToDeleteTaskInstances) {
-            ILogService iLogService =
-                    SingletonJdkDynamicRpcClientProxyFactory.getProxyClient(taskInstance.getHost(), ILogService.class);
-            iLogService.removeTaskInstanceLog(taskInstance.getLogPath());
+            if (StringUtils.isNotBlank(taskInstance.getLogPath())) {
+                ILogService iLogService =
+                        SingletonJdkDynamicRpcClientProxyFactory.getProxyClient(taskInstance.getHost(),
+                                ILogService.class);
+                iLogService.removeTaskInstanceLog(taskInstance.getLogPath());
+            }
         }
 
         dqExecuteResultDao.deleteByWorkflowInstanceId(workflowInstanceId);