This is an automated email from the ASF dual-hosted git repository.

liulijia pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 9c6bff6b36e [fix](excutor) Fix high priority push task thread hold 
lock long time (#48177)
9c6bff6b36e is described below

commit 9c6bff6b36e4170f3f3a00700f2a5f3e1e4af727
Author: Lijia Liu <liutang...@yeah.net>
AuthorDate: Mon Mar 3 09:56:05 2025 +0800

    [fix](excutor) Fix high priority push task thread hold lock long time 
(#48177)
    
    ### What problem does this PR solve?
    Intruduced by #23538
    Sleep after release the lock.
    
    Co-authored-by: liutang123 <liuli...@gmail.com>
---
 be/src/agent/task_worker_pool.cpp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/be/src/agent/task_worker_pool.cpp 
b/be/src/agent/task_worker_pool.cpp
index c95b782d3b3..b3e35842849 100644
--- a/be/src/agent/task_worker_pool.cpp
+++ b/be/src/agent/task_worker_pool.cpp
@@ -567,6 +567,7 @@ void PushTaskPool::_push_worker_thread_callback() {
 
     while (_is_work) {
         TAgentTaskRequest agent_task_req;
+        bool get_task = false;
         {
             std::unique_lock<std::mutex> 
worker_thread_lock(_worker_thread_lock);
             _worker_thread_condition_variable.wait(
@@ -583,17 +584,23 @@ void PushTaskPool::_push_worker_thread_callback() {
 
                 if (it == _tasks.cend()) {
                     // there is no high priority task. notify other thread to 
handle normal task
+                    get_task = false;
                     _worker_thread_condition_variable.notify_all();
-                    sleep(1);
-                    continue;
+                } else {
+                    agent_task_req = std::move(*it);
+                    _tasks.erase(it);
+                    get_task = true;
                 }
-                agent_task_req = std::move(*it);
-                _tasks.erase(it);
             } else {
                 agent_task_req = std::move(_tasks.front());
                 _tasks.pop_front();
+                get_task = true;
             }
         }
+        if (!get_task) { // There is no HIGH priority task.
+            sleep(1);
+            continue;
+        }
         TPushReq& push_req = agent_task_req.push_req;
 
         LOG(INFO) << "get push task. signature=" << agent_task_req.signature


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to