fix: SubProcess task may fall into an endless-loop by fault-tolerant#6063
fix: SubProcess task may fall into an endless-loop by fault-tolerant#6063reele wants to merge 3 commits intoapache:devfrom
Conversation
|
hi, can you resolve the CI check Fail? |
|
OK. |
Codecov Report
@@ Coverage Diff @@
## dev #6063 +/- ##
============================================
- Coverage 46.36% 46.36% -0.01%
- Complexity 3733 3738 +5
============================================
Files 608 608
Lines 25062 25065 +3
Branches 2866 2867 +1
============================================
+ Hits 11621 11622 +1
- Misses 12295 12299 +4
+ Partials 1146 1144 -2
Continue to review full report at Codecov.
|
|
Kudos, SonarCloud Quality Gate passed! |
| * (when recover a stopping instance, subProcessInstance may still in running by fault-tolerant) | ||
| */ | ||
| private boolean isTaskInstanceFinished() { | ||
| boolean isSubProcessFinished = (subProcessInstance == null || subProcessInstance.getState().typeIsFinished()); |
There was a problem hiding this comment.
we have already checked the sub process is not null.
There was a problem hiding this comment.
It is used to ensure that subProcessInstance.getState() is valid, it may still be null at this position.
There was a problem hiding this comment.
After submitting the task by super.submit(), the subprocess will be submitted to the command list. and the subprocess has not been established.
| */ | ||
| private void waitSubProcessEstablishment() throws InterruptedException { | ||
| if (subProcessInstance == null) { | ||
| while (Stopper.isRunning()) { |
There was a problem hiding this comment.
i think it's better to merge this 'while' into the other.
There was a problem hiding this comment.
In the beginning, I just inserted a condition, by '&&', it caused SonarCloud smells of cognitive complexity.
this segment is the most complicated in waitTaskQuit() (+3), so i cut it into a new method.
And the old segment caused another code smell, merge means a big change.
|
@reele Thank you very much for your contribution, the implementation of sub-process is reconstructed. |
|
well, because of the json-split is not completed, the depenent node still used 'id' to reference the process_id, i can't import the 6000 tasks' dag of dw to test the stability, i may try it at some other times. |








Purpose of the pull request
SubProcessTaskExecThread.waitTaskQuit()will return directly, and set task state with sub-process's state (even if the sub-process is running, such asREADY_PAUSE/READY_STOPor others), so the sub-process-task will ended with an unfinished state (READY_PAUSEorREADY_STOP),so the parent thread
MasterExecThreadwill fall into an endless-loop.Brief change log
SubProcessTaskExecThread.waitTaskQuit()should checksubProcessInstance's state first:subProcessInstanceis not null and its state is unfinished, it still enters the waiting loop.Issue
#6062