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 46975441c98 1 (#33929)
46975441c98 is described below

commit 46975441c98a8f70c9b83080465787af2d4f7310
Author: Xinyi Zou <zouxiny...@gmail.com>
AuthorDate: Sun Apr 21 01:07:49 2024 +0800

    1 (#33929)
    
    fix:
    
    F20240420 12:47:23.222411 31558 thread_context.h:164] Check failed: 
thread_mem_tracker()->label() == "Orphan" , thread mem tracker label: 
Load#Id=b43f342ae5564c23-b7b41daf24545f78, attach mem tracker label: 
Load#Id=4241cef180013366-1ba9f658007f339a
    12:49:46   *** Check failure stack trace: ***
    12:49:46       @     0x55584aae5d26  google::LogMessage::SendToLog()
    12:49:46       @     0x55584aae2770  google::LogMessage::Flush()
    12:49:46       @     0x55584aae6569  
google::LogMessageFatal::~LogMessageFatal()
    12:49:46       @     0x55581abce4ae  doris::ThreadContext::attach_task()
    12:49:46       @     0x55581abc8e8e  doris::AttachTask::AttachTask()
    12:49:46       @     0x5558170a055b  doris::MemTableWriter::flush_async()
    12:49:46       @     0x5558170604ee  
doris::MemTableMemoryLimiter::_flush_memtable()
    12:49:46       @     0x55581705e8e6  
doris::MemTableMemoryLimiter::_flush_active_memtables()
    12:49:46       @     0x55581705d986  
doris::MemTableMemoryLimiter::handle_memtable_flush()
    12:49:46       @     0x555848c9a36d  
doris::vectorized::VTabletWriterV2::_write_memtable()
    12:49:46       @     0x555848c990c8  
doris::vectorized::VTabletWriterV2::write()
---
 be/src/olap/memtable_writer.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/memtable_writer.cpp b/be/src/olap/memtable_writer.cpp
index 90762088540..f37a88e726d 100644
--- a/be/src/olap/memtable_writer.cpp
+++ b/be/src/olap/memtable_writer.cpp
@@ -151,7 +151,12 @@ Status MemTableWriter::_flush_memtable_async() {
 
 Status MemTableWriter::flush_async() {
     std::lock_guard<std::mutex> l(_lock);
-    SCOPED_ATTACH_TASK(_query_thread_context);
+    // In order to avoid repeated ATTACH, use SWITCH here. have two calling 
paths:
+    // 1. call by local, from `VTabletWriterV2::_write_memtable`, has been 
ATTACH Load memory tracker
+    // into thread context, ATTACH cannot be repeated here.
+    // 2. call by remote, from `LoadChannelMgr::_get_load_channel`, no ATTACH 
because LoadChannelMgr
+    // not know Load context.
+    
SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(_query_thread_context.query_mem_tracker);
     if (!_is_init || _is_closed) {
         // This writer is uninitialized or closed before flushing, do nothing.
         // We return OK instead of NOT_INITIALIZED or ALREADY_CLOSED.


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

Reply via email to