You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by we...@apache.org on 2022/11/27 07:34:33 UTC
[dolphinscheduler] branch dev updated: Set max loop times when consume StateEvent to avoid dead loop influence the thread. (#13007)
This is an automated email from the ASF dual-hosted git repository.
wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 1a8811cb41 Set max loop times when consume StateEvent to avoid dead loop influence the thread. (#13007)
1a8811cb41 is described below
commit 1a8811cb419551045d0d05b99116e2d2560d6a6f
Author: Wenjun Ruan <we...@apache.org>
AuthorDate: Sun Nov 27 15:34:26 2022 +0800
Set max loop times when consume StateEvent to avoid dead loop influence the thread. (#13007)
---
.../server/master/runner/WorkflowExecuteRunnable.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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 5855fb7d9c..104ce4ae2a 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
@@ -285,10 +285,13 @@ public class WorkflowExecuteRunnable implements Callable<WorkflowSubmitStatue> {
stateEvents);
return;
}
- StateEvent stateEvent = null;
- while (!this.stateEvents.isEmpty()) {
+ int loopTimes = stateEvents.size();
+ for (int i = 0; i < loopTimes; i++) {
+ final StateEvent stateEvent = this.stateEvents.peek();
try {
- stateEvent = this.stateEvents.peek();
+ if (stateEvent == null) {
+ return;
+ }
LoggerUtils.setWorkflowAndTaskInstanceIDMDC(stateEvent.getProcessInstanceId(),
stateEvent.getTaskInstanceId());
// if state handle success then will remove this state, otherwise will retry this state next time.