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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new e231bba80ed branch-4.0: [Bug](memtracker) fix wrong memtracker scope 
on PipelineTask destructor #57276 (#57280)
e231bba80ed is described below

commit e231bba80ed236ceff761c3703ed751795a1fe96
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Oct 24 11:58:15 2025 +0800

    branch-4.0: [Bug](memtracker) fix wrong memtracker scope on PipelineTask 
destructor #57276 (#57280)
    
    Cherry-picked from #57276
    
    Co-authored-by: Pxl <[email protected]>
---
 be/src/pipeline/pipeline_task.cpp | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/be/src/pipeline/pipeline_task.cpp 
b/be/src/pipeline/pipeline_task.cpp
index 7fe201f3802..0f3309da395 100644
--- a/be/src/pipeline/pipeline_task.cpp
+++ b/be/src/pipeline/pipeline_task.cpp
@@ -96,6 +96,15 @@ PipelineTask::PipelineTask(PipelinePtr& pipeline, uint32_t 
task_id, RuntimeState
 }
 
 PipelineTask::~PipelineTask() {
+    auto reset_member = [&]() {
+        _shared_state_map.clear();
+        _sink_shared_state.reset();
+        _op_shared_states.clear();
+        _sink.reset();
+        _operators.clear();
+        _block.reset();
+        _pipeline.reset();
+    };
 // PipelineTask is also hold by task queue( 
https://github.com/apache/doris/pull/49753),
 // so that it maybe the last one to be destructed.
 // But pipeline task hold some objects, like operators, shared state, etc. So 
that should release
@@ -103,15 +112,11 @@ PipelineTask::~PipelineTask() {
 #ifndef BE_TEST
     if (_query_mem_tracker) {
         SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(_query_mem_tracker);
+        reset_member();
+        return;
     }
 #endif
-    _shared_state_map.clear();
-    _sink_shared_state.reset();
-    _op_shared_states.clear();
-    _sink.reset();
-    _operators.clear();
-    _block.reset();
-    _pipeline.reset();
+    reset_member();
 }
 
 Status PipelineTask::prepare(const std::vector<TScanRangeParams>& scan_range, 
const int sender_id,


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

Reply via email to