You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/09/02 12:26:52 UTC

[GitHub] [dolphinscheduler] lenboo commented on a change in pull request #6063: fix: SubProcess task may fall into an endless-loop by fault-tolerant

lenboo commented on a change in pull request #6063:
URL: https://github.com/apache/dolphinscheduler/pull/6063#discussion_r701032167



##########
File path: dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/SubProcessTaskExecThread.java
##########
@@ -112,6 +112,31 @@ private void updateParentProcessState(){
         this.processInstance.setState(parentProcessInstance.getState());
     }
 
+    /**
+     * wait for the establishment of sub-process-instance
+     * @throws InterruptedException
+     */
+    private void waitSubProcessEstablishment() throws InterruptedException {
+        if (subProcessInstance == null) {
+            while (Stopper.isRunning()) {
+                Thread.sleep(Constants.SLEEP_TIME_MILLIS);
+                if (setTaskInstanceState()) {
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * check if both task and sub-process are both finished
+     * (when recover a stopping instance, subProcessInstance may still in running by fault-tolerant)
+     */
+    private boolean isTaskInstanceFinished() {
+        boolean isSubProcessFinished = (subProcessInstance == null || subProcessInstance.getState().typeIsFinished());

Review comment:
       we have already checked the sub process is not null.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org