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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 8f5deb10be2 [be](oom) add stacktrace in debugmode to find oom reason
8f5deb10be2 is described below

commit 8f5deb10be27546672ec24245c231d221fc3205c
Author: yiguolei <yiguo...@gmail.com>
AuthorDate: Sun May 26 23:38:50 2024 +0800

    [be](oom) add stacktrace in debugmode to find oom reason
---
 be/src/vec/common/allocator.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/be/src/vec/common/allocator.cpp b/be/src/vec/common/allocator.cpp
index f6758a2dbb9..35418dea08b 100644
--- a/be/src/vec/common/allocator.cpp
+++ b/be/src/vec/common/allocator.cpp
@@ -102,6 +102,9 @@ void Allocator<clear_memory_, mmap_populate, 
use_mmap>::sys_memory_check(size_t
                 doris::MemTrackerLimiter::print_log_process_usage();
                 // If the external catch, throw bad::alloc first, let the 
query actively cancel. Otherwise asynchronous cancel.
                 if (!doris::enable_thread_catch_bad_alloc) {
+#ifndef NDEBUG
+                    err_msg += "\nAlloc Stacktrace:\n" + 
doris::get_stack_trace();
+#endif
                     LOG(INFO) << fmt::format(
                             "Query:{} canceled asyn, after waiting for memory 
{}ms, {}.",
                             print_id(doris::thread_context()->task_id()), 
wait_milliseconds,
@@ -121,6 +124,9 @@ void Allocator<clear_memory_, mmap_populate, 
use_mmap>::sys_memory_check(size_t
             doris::MemTrackerLimiter::print_log_process_usage();
             throw doris::Exception(doris::ErrorCode::MEM_ALLOC_FAILED, 
err_msg);
         } else {
+#ifndef NDEBUG
+            err_msg += "\nAlloc Stacktrace:\n" + doris::get_stack_trace();
+#endif
             LOG(INFO) << fmt::format("sys memory check failed, no throw 
exception, {}.", err_msg);
         }
     }


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

Reply via email to