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
commit cb2598e8146af912a83bef7f663ab3cdfb1a6dae Author: Xinyi Zou <[email protected]> AuthorDate: Sun Apr 21 01:07:49 2024 +0800 [bugfix](memtracker) memtracker is attached duplicately (#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 dde76fec389..940359641ba 100644 --- a/be/src/olap/memtable_writer.cpp +++ b/be/src/olap/memtable_writer.cpp @@ -145,7 +145,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: [email protected] For additional commands, e-mail: [email protected]
