You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by zo...@apache.org on 2023/06/26 02:28:31 UTC
[doris] branch master updated: [fix](memory) fix mem tracker grace exit (#21136)
This is an automated email from the ASF dual-hosted git repository.
zouxinyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6f7759b08d [fix](memory) fix mem tracker grace exit (#21136)
6f7759b08d is described below
commit 6f7759b08d717a44cac84adc22f3e53b6b30698d
Author: Xinyi Zou <zo...@gmail.com>
AuthorDate: Mon Jun 26 10:28:24 2023 +0800
[fix](memory) fix mem tracker grace exit (#21136)
---
be/src/runtime/exec_env_init.cpp | 4 ++++
be/src/runtime/memory/mem_tracker.cpp | 3 ++-
be/src/runtime/memory/mem_tracker_limiter.cpp | 3 ++-
be/src/vec/exprs/vexpr_context.cpp | 2 --
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 5d977e1004..8875cf5463 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -424,6 +424,10 @@ void ExecEnv::_destroy() {
_join_node_thread_pool.reset(nullptr);
_serial_download_cache_thread_token.reset(nullptr);
_download_cache_thread_pool.reset(nullptr);
+ _orphan_mem_tracker.reset();
+ _experimental_mem_tracker.reset();
+ _page_no_cache_mem_tracker.reset();
+ _brpc_iobuf_block_memory_tracker.reset();
_is_init = false;
}
diff --git a/be/src/runtime/memory/mem_tracker.cpp b/be/src/runtime/memory/mem_tracker.cpp
index bf3902821d..7ec943090d 100644
--- a/be/src/runtime/memory/mem_tracker.cpp
+++ b/be/src/runtime/memory/mem_tracker.cpp
@@ -24,6 +24,7 @@
#include <mutex>
+#include "common/daemon.h"
#include "runtime/memory/mem_tracker_limiter.h"
#include "runtime/thread_context.h"
@@ -81,7 +82,7 @@ void MemTracker::bind_parent(MemTrackerLimiter* parent) {
}
MemTracker::~MemTracker() {
- if (_parent_group_num != -1) {
+ if (_parent_group_num != -1 && !k_doris_exit) {
std::lock_guard<std::mutex> l(mem_tracker_pool[_parent_group_num].group_lock);
if (_tracker_group_it != mem_tracker_pool[_parent_group_num].trackers.end()) {
mem_tracker_pool[_parent_group_num].trackers.erase(_tracker_group_it);
diff --git a/be/src/runtime/memory/mem_tracker_limiter.cpp b/be/src/runtime/memory/mem_tracker_limiter.cpp
index ded5b0c0b8..d03bd1ac00 100644
--- a/be/src/runtime/memory/mem_tracker_limiter.cpp
+++ b/be/src/runtime/memory/mem_tracker_limiter.cpp
@@ -26,6 +26,7 @@
#include <queue>
#include <utility>
+#include "common/daemon.h"
#include "runtime/exec_env.h"
#include "runtime/fragment_mgr.h"
#include "runtime/load_channel_mgr.h"
@@ -79,7 +80,7 @@ MemTrackerLimiter::~MemTrackerLimiter() {
// in real time. Merge its consumption into orphan when parent is process, to avoid repetition.
ExecEnv::GetInstance()->orphan_mem_tracker()->consume(_consumption->current_value());
_consumption->set(0);
- {
+ if (!k_doris_exit) {
std::lock_guard<std::mutex> l(mem_tracker_limiter_pool[_group_num].group_lock);
if (_tracker_limiter_group_it != mem_tracker_limiter_pool[_group_num].trackers.end()) {
mem_tracker_limiter_pool[_group_num].trackers.erase(_tracker_limiter_group_it);
diff --git a/be/src/vec/exprs/vexpr_context.cpp b/be/src/vec/exprs/vexpr_context.cpp
index 5a309a0d49..236dfc4045 100644
--- a/be/src/vec/exprs/vexpr_context.cpp
+++ b/be/src/vec/exprs/vexpr_context.cpp
@@ -21,8 +21,6 @@
#include <ostream>
#include <string>
-#include "common/daemon.h"
-
// IWYU pragma: no_include <opentelemetry/common/threadlocal.h>
#include "common/compiler_util.h" // IWYU pragma: keep
#include "common/object_pool.h"
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org