Browse Source

Set max loop times when consume StateEvent to avoid dead loop influence the thread. (#13007)

3.2.0-release
Wenjun Ruan 2 years ago committed by GitHub
parent
commit
1a8811cb41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java

9
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java

@ -285,10 +285,13 @@ public class WorkflowExecuteRunnable implements Callable<WorkflowSubmitStatue> {
stateEvents); stateEvents);
return; return;
} }
StateEvent stateEvent = null; int loopTimes = stateEvents.size();
while (!this.stateEvents.isEmpty()) { for (int i = 0; i < loopTimes; i++) {
final StateEvent stateEvent = this.stateEvents.peek();
try { try {
stateEvent = this.stateEvents.peek(); if (stateEvent == null) {
return;
}
LoggerUtils.setWorkflowAndTaskInstanceIDMDC(stateEvent.getProcessInstanceId(), LoggerUtils.setWorkflowAndTaskInstanceIDMDC(stateEvent.getProcessInstanceId(),
stateEvent.getTaskInstanceId()); stateEvent.getTaskInstanceId());
// if state handle success then will remove this state, otherwise will retry this state next time. // if state handle success then will remove this state, otherwise will retry this state next time.

Loading…
Cancel
Save