caishunfeng commented on code in PR #11480:
URL: https://github.com/apache/dolphinscheduler/pull/11480#discussion_r947505949


##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowEventLooper.java:
##########
@@ -74,6 +76,10 @@ public void run() {
         while (!ServerLifeCycleManager.isStopped()) {
             try {
                 workflowEvent = workflowEventQueue.poolEvent();
+                if (!ServerLifeCycleManager.isRunning()) {
+                    logger.info("The current server is not running, will drop 
this event: {}", workflowEvent);
+                    continue;

Review Comment:
   It's better to add a sleep when waiting, otherwise, there will be an empty 
loop all the time leading to high CPU.



##########
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskDispatchProcessor.java:
##########
@@ -202,7 +198,12 @@ public void process(Channel channel, Command command) {
                         workerManager.getWaitSubmitQueueSize(),
                         taskExecutionContext.getTaskInstanceId());
                 workerMessageSender.sendMessageWithRetry(taskExecutionContext, 
masterAddress, CommandType.TASK_REJECT);
+                throw new TaskException("The task waiting queue is full, will 
reject this task");
             }
+        } catch (Exception ex) {
+            logger.error("Worker handle the dispatch task message failed, will 
remove the taskExecutionContext: {} from cache", taskExecutionContext);
+            
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId());
+            throw ex;

Review Comment:
   Will the master dispatch fail if throw an exception here?



-- 
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