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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new e4ae166f7f5 [Bug](profile) move watcher.stop() into locked code block 
(#62682)
e4ae166f7f5 is described below

commit e4ae166f7f5bf0e017df70e87a3772d21203051e
Author: Pxl <[email protected]>
AuthorDate: Wed Apr 22 14:11:02 2026 +0800

    [Bug](profile) move watcher.stop() into locked code block (#62682)
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #56462
    
    Problem Summary:
    
    Backport of #56462 to this branch.
    
    `Dependency::set_ready()` previously called `_watcher.stop()` outside
    `_task_lock`. A concurrent `is_blocked_by()` (which acquires
    `_task_lock`, checks `_ready`, and calls `start_watcher()`) could
    re-start the watcher right after `stop()` but before `_ready = true` was
    published; nothing stops it again. As a result `watcher_elapse_time()`
    accumulates wall-clock time from the first block until the operator
    closes, making `WaitForDependency` / `WaitForRuntimeFilter` profile
    counters appear hugely inflated (e.g. ~12s on a 20s query while each
    individual RF `WaitTime` is only tens of ms).
    
    Move `_watcher.stop()` inside the `_task_lock` block, before setting
    `_ready = true`, matching the master fix.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test:
    - No need to test (profile-only fix; identical to merged master change
    #56462)
    - Behavior changed: No
    - Does this need documentation: No
    
    Co-authored-by: Copilot <[email protected]>
---
 be/src/exec/pipeline/dependency.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/be/src/exec/pipeline/dependency.cpp 
b/be/src/exec/pipeline/dependency.cpp
index 09239835073..87d53c20991 100644
--- a/be/src/exec/pipeline/dependency.cpp
+++ b/be/src/exec/pipeline/dependency.cpp
@@ -66,13 +66,13 @@ void Dependency::set_ready() {
     if (_ready) {
         return;
     }
-    _watcher.stop();
     std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
     {
         std::unique_lock<std::mutex> lc(_task_lock);
         if (_ready) {
             return;
         }
+        _watcher.stop();
         _ready = true;
         local_block_task.swap(_blocked_task);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to