You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2022/06/07 03:31:56 UTC

[incubator-doris] branch master updated: [fix][mem tracker] Fix logout load task mem tracker dcheck fail (#9943)

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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new d588e99b8b [fix][mem tracker] Fix logout load task mem tracker dcheck fail (#9943)
d588e99b8b is described below

commit d588e99b8bd94aa7e3801332dc02928a4b8c63c4
Author: Xinyi Zou <zo...@gmail.com>
AuthorDate: Tue Jun 7 11:31:49 2022 +0800

    [fix][mem tracker] Fix logout load task mem tracker dcheck fail (#9943)
    
    * fix tracker 0602
    
    * fix format
---
 be/src/runtime/load_channel.cpp          |  4 ++--
 be/src/runtime/mem_tracker_task_pool.cpp | 11 ++++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/be/src/runtime/load_channel.cpp b/be/src/runtime/load_channel.cpp
index 55038e2742..1c270a3473 100644
--- a/be/src/runtime/load_channel.cpp
+++ b/be/src/runtime/load_channel.cpp
@@ -34,8 +34,8 @@ LoadChannel::LoadChannel(const UniqueId& load_id, int64_t mem_limit, int64_t tim
           _is_vec(is_vec) {
     _mem_tracker = MemTracker::create_tracker(
             mem_limit, "LoadChannel:tabletId=" + _load_id.to_string(),
-            ExecEnv::GetInstance()->task_pool_mem_tracker_registry()->get_task_mem_tracker(
-                    _load_id.to_string()),
+            ExecEnv::GetInstance()->task_pool_mem_tracker_registry()->register_load_mem_tracker(
+                    _load_id.to_string(), mem_limit),
             MemTrackerLevel::TASK);
     // _last_updated_time should be set before being inserted to
     // _load_channels in load_channel_mgr, or it may be erased
diff --git a/be/src/runtime/mem_tracker_task_pool.cpp b/be/src/runtime/mem_tracker_task_pool.cpp
index 132b47f573..551d904111 100644
--- a/be/src/runtime/mem_tracker_task_pool.cpp
+++ b/be/src/runtime/mem_tracker_task_pool.cpp
@@ -89,9 +89,14 @@ void MemTrackerTaskPool::logout_task_mem_tracker() {
         }
     }
     for (auto tid : expired_tasks) {
-        DCHECK(_task_mem_trackers[tid].use_count() == 1);
-        _task_mem_trackers.erase(tid);
-        VLOG_FILE << "Deregister task memory tracker, task id: " << tid;
+        // This means that after all RuntimeState is destructed,
+        // there are still task mem trackers that are get or register.
+        // The only known case: after an load task ends all fragments on a BE,`tablet_writer_open` is still
+        // called to create a channel, and the load task tracker will be re-registered in the channel open.
+        if (_task_mem_trackers[tid].use_count() == 1) {
+            _task_mem_trackers.erase(tid);
+            VLOG_FILE << "Deregister task memory tracker, task id: " << tid;
+        }
     }
 }
 


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