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 2022/09/08 14:44:32 UTC
[GitHub] [dolphinscheduler] DarkAssassinator commented on a diff in pull request #11864: [Bug] [Master] WorkflowExecuteRunnable will face a infinite loop #11838
DarkAssassinator commented on code in PR #11864:
URL: https://github.com/apache/dolphinscheduler/pull/11864#discussion_r966062367
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/TaskTimeoutStateEventHandler.java:
##########
@@ -34,29 +34,34 @@ public class TaskTimeoutStateEventHandler implements StateEventHandler {
@Override
public boolean handleStateEvent(WorkflowExecuteRunnable workflowExecuteRunnable,
- StateEvent stateEvent) throws StateEventHandleError {
+ StateEvent stateEvent) throws StateEventHandleError {
TaskStateEvent taskStateEvent = (TaskStateEvent) stateEvent;
TaskMetrics.incTaskInstanceByState("timeout");
workflowExecuteRunnable.checkTaskInstanceByStateEvent(taskStateEvent);
TaskInstance taskInstance =
- workflowExecuteRunnable.getTaskInstance(taskStateEvent.getTaskInstanceId()).orElseThrow(
- () -> new StateEventHandleError(String.format(
- "Cannot find the task instance from workflow execute runnable, taskInstanceId: %s",
- taskStateEvent.getTaskInstanceId())));
+ workflowExecuteRunnable.getTaskInstance(taskStateEvent.getTaskInstanceId()).orElseThrow(
+ () -> new StateEventHandleError(String.format(
+ "Cannot find the task instance from workflow execute runnable, taskInstanceId: %s",
+ taskStateEvent.getTaskInstanceId())));
if (TimeoutFlag.CLOSE == taskInstance.getTaskDefine().getTimeoutFlag()) {
return true;
}
- TaskTimeoutStrategy taskTimeoutStrategy = taskInstance.getTaskDefine().getTimeoutNotifyStrategy();
- Map<Long, ITaskProcessor> activeTaskProcessMap = workflowExecuteRunnable.getActiveTaskProcessMap();
- if (TaskTimeoutStrategy.FAILED == taskTimeoutStrategy
- || TaskTimeoutStrategy.WARNFAILED == taskTimeoutStrategy) {
- ITaskProcessor taskProcessor = activeTaskProcessMap.get(taskInstance.getTaskCode());
- taskProcessor.action(TaskAction.TIMEOUT);
+ TaskTimeoutStrategy taskTimeoutStrategy = taskInstance.getTaskDefine()
+ .getTimeoutNotifyStrategy();
+ Map<Long, ITaskProcessor> activeTaskProcessMap = workflowExecuteRunnable
+ .getActiveTaskProcessMap();
+ if ((TaskTimeoutStrategy.FAILED == taskTimeoutStrategy
+ || TaskTimeoutStrategy.WARNFAILED == taskTimeoutStrategy)) {
+ if (activeTaskProcessMap.containsKey(taskInstance.getTaskCode())) {
Review Comment:
if task instance failure, it will submit a `StateEventType.TASK_STATE_CHANGE`, `TaskStateEventHandler` will call `workflowExecuteRunnable.taskFinished(task)` and remove this `taskProcessor`
--
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