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

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


The following commit(s) were added to refs/heads/spill_and_reserve by this push:
     new 91db33a81cb [fix](memory) Fix reset Jemalloc `dirty_decay_ms` failed 
(#46710)
91db33a81cb is described below

commit 91db33a81cb3488b92297519b97e3ec2010f5fe6
Author: Xinyi Zou <zouxi...@selectdb.com>
AuthorDate: Fri Jan 10 19:16:02 2025 +0800

    [fix](memory) Fix reset Jemalloc `dirty_decay_ms` failed (#46710)
    
    ### What problem does this PR solve?
    
    Introduced pr: #46136
    fix:
    ```
    start BE in local mode
    *** Query id: 0-0 ***
    *** is nereids: 0 ***
    *** tablet id: 0 ***
    *** Aborted at 1736203429 (unix time) try "date -d @1736203429" if you are 
using GNU date ***
    *** Current BE git commitID: 5ee7e73313 ***
    *** SIGSEGV address not mapped to object (@0x7b228e) received by PID 4568 
(TID 6464 OR 0x7fd390c11640) from PID 8069774; stack trace: ***
     0# doris::signal::(anonymous namespace)::FailureSignalHandler(int, 
siginfo_t*, void*) at /doris/be/src/common/signal_handler.h:421
     1# PosixSignals::chained_handler(int, siginfo*, void*) [clone .part.0] in 
/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
     2# JVM_handle_linux_signal in 
/usr/lib/jvm/java-17-openjdk-amd64/lib/server/libjvm.so
     3# 0x00007FD7DC196520 in /lib/x86_64-linux-gnu/libc.so.6
     4# je_pac_decay_ms_get at ../src/pac.c:555
     5# arena_i_dirty_decay_ms_ctl at ../src/ctl.c:2870
     6# je_ctl_byname at ../src/ctl.c:1574
     7# void 
doris::MemInfo::set_jemallctl_value<long>(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, long) at 
/doris/be/src/util/mem_info.h:123
     8# doris::Daemon::je_reset_dirty_decay_thread() const at 
/doris/be/src/common/daemon.cpp:533
     9# doris::Thread::supervise_thread(void*) at 
/doris/be/src/util/thread.cpp:499
    10# start_thread at ./nptl/pthread_create.c:442
    11# 0x00007FD7DC27A850 at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:83
    ```
---
 be/src/util/mem_info.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/be/src/util/mem_info.h b/be/src/util/mem_info.h
index 5d1d0c75367..3fa0fdbd709 100644
--- a/be/src/util/mem_info.h
+++ b/be/src/util/mem_info.h
@@ -107,6 +107,8 @@ public:
         size_t value_size = sizeof(T);
         if (jemallctl(name.c_str(), &value, &value_size, nullptr, 0) == 0) {
             return value;
+        } else {
+            LOG(WARNING) << fmt::format("Failed, jemallctl get {}", name);
         }
 #endif
         return 0;
@@ -123,9 +125,6 @@ public:
             if (err) {
                 LOG(WARNING) << fmt::format("Failed, jemallctl value for {} 
set to {} (old {})",
                                             name, value, old_value);
-            } else {
-                LOG(INFO) << fmt::format("Successfully, jemallctl value for {} 
set to {} (old {})",
-                                         name, value, old_value);
             }
         } catch (...) {
             LOG(WARNING) << fmt::format("Exception, jemallctl value for {} set 
to {} (old {})",
@@ -140,8 +139,6 @@ public:
             int err = jemallctl(name.c_str(), nullptr, nullptr, nullptr, 0);
             if (err) {
                 LOG(WARNING) << fmt::format("Failed, jemallctl action {}", 
name);
-            } else {
-                LOG(INFO) << fmt::format("Successfully, jemallctl action {}", 
name);
             }
         } catch (...) {
             LOG(WARNING) << fmt::format("Exception, jemallctl action {}", 
name);
@@ -181,8 +178,12 @@ public:
         // Each time this interface is set, all currently unused dirty pages 
are considered
         // to have fully decayed, which causes immediate purging of all unused 
dirty pages unless
         // the decay time is set to -1
-        set_jemallctl_value<ssize_t>(fmt::format("arena.{}.dirty_decay_ms", 
MALLCTL_ARENAS_ALL),
-                                     dirty_decay_ms);
+        //
+        // NOTE: Using "arena.MALLCTL_ARENAS_ALL.dirty_decay_ms" to modify all 
arenas will fail or even crash,
+        // which may be a bug.
+        for (unsigned i = 0; i < 
get_jemallctl_value<unsigned>("arenas.narenas"); i++) {
+            
set_jemallctl_value<ssize_t>(fmt::format("arena.{}.dirty_decay_ms", i), 
dirty_decay_ms);
+        }
 #endif
     }
 


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

Reply via email to