ruanwenjun commented on code in PR #18344:
URL: 
https://github.com/apache/dolphinscheduler/pull/18344#discussion_r3409514231


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/statemachine/TaskSubmittedStateAction.java:
##########
@@ -143,6 +143,15 @@ public void onPauseEvent(final IWorkflowExecution 
workflowExecution,
             
taskExecution.getWorkflowEventBus().publish(TaskPausedLifecycleEvent.of(taskExecution));
             return;
         }
+        // Task not in dispatch queue, check if it's waiting for TaskGroup slot
+        if 
(taskGroupCoordinator.isTaskWaitingForTaskGroupSlot(taskExecution.getTaskInstance()))
 {
+            // Release the TaskGroupQueue first to prevent TaskGroupCoordinator
+            // from concurrently acquiring the slot and racing with this pause
+            
taskGroupCoordinator.releaseTaskGroupSlot(taskExecution.getTaskInstance());
+            log.info("Task: {} is waiting for TaskGroup slot, pause it 
directly", taskExecution.getName());
+            
taskExecution.getWorkflowEventBus().publish(TaskPausedLifecycleEvent.of(taskExecution));
+            return;
+        }

Review Comment:
   This may result in a state error due to concurrency.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to