From d50a848eb5f589e49e9f9232f90a388c2e541423 Mon Sep 17 00:00:00 2001 From: Xinyi Zou Date: Thu, 6 Jun 2024 14:54:43 +0800 Subject: [PATCH] 1 --- be/src/common/config.cpp | 2 ++ be/src/common/config.h | 5 ++++- be/src/vec/common/allocator.cpp | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp index e754917e016f8f..ca0c443f748858 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -135,6 +135,8 @@ DEFINE_mBool(enable_query_memory_overcommit, "true"); DEFINE_mBool(disable_memory_gc, "false"); +DEFINE_mBool(enable_stacktrace_in_allocator_check_failed, "false"); + DEFINE_mInt64(large_memory_check_bytes, "2147483648"); DEFINE_mBool(enable_memory_orphan_check, "true"); diff --git a/be/src/common/config.h b/be/src/common/config.h index b1a825a462bdee..17e2877cc0a24b 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -174,11 +174,14 @@ DECLARE_mString(process_full_gc_size); // used memory and the exec_mem_limit will be canceled. // If false, cancel query when the memory used exceeds exec_mem_limit, same as before. DECLARE_mBool(enable_query_memory_overcommit); -//waibibabu + // gc will release cache, cancel task, and task will wait for gc to release memory, // default gc strategy is conservative, if you want to exclude the interference of gc, let it be true DECLARE_mBool(disable_memory_gc); +// Allocator check failed log stacktrace if not catch exception +DECLARE_mBool(enable_stacktrace_in_allocator_check_failed); + // malloc or new large memory larger than large_memory_check_bytes, default 2G, // will print a warning containing the stacktrace, but not prevent memory alloc. // If is -1, disable large memory check. diff --git a/be/src/vec/common/allocator.cpp b/be/src/vec/common/allocator.cpp index a012cdee41a59e..a5eb6445933927 100644 --- a/be/src/vec/common/allocator.cpp +++ b/be/src/vec/common/allocator.cpp @@ -89,8 +89,9 @@ void Allocator::sys_memory_check(size_t doris::thread_context()->thread_mem_tracker_mgr->last_consumer_tracker(), doris::GlobalMemoryArbitrator::process_limit_exceeded_errmsg_str()); - if (size > 1024L * 1024 * 1024 && !doris::enable_thread_catch_bad_alloc && - !doris::config::disable_memory_gc) { // 1G + if (!doris::enable_thread_catch_bad_alloc && + (size > 1024L * 1024 * 1024 || + doris::config::enable_stacktrace_in_allocator_check_failed)) { err_msg += "\nAlloc Stacktrace:\n" + doris::get_stack_trace(); }