[fix](memory) Fix Allocator release memory to correct MemTracker after TLS attach task ends#39908
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
TPC-H: Total hot run time: 38256 ms |
TPC-DS: Total hot run time: 186640 ms |
ClickBench: Total hot run time: 31.25 s |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
|
clang-tidy review says "All clean, LGTM! 👍" |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
TPC-H: Total hot run time: 38447 ms |
TPC-DS: Total hot run time: 186686 ms |
ClickBench: Total hot run time: 31.84 s |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
DCHECK(doris::thread_context()->thread_mem_tracker()->type() != doris::MemTrackerLimiter::Type::QUERY || doris::thread_context()->thread_mem_tracker()->label() == mem_tracker_->label()) |
|
run buildall |
|
run buildall |
|
clang-tidy review says "All clean, LGTM! 👍" |
TPC-H: Total hot run time: 37925 ms |
TPC-DS: Total hot run time: 192644 ms |
ClickBench: Total hot run time: 32.28 s |
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
…r TLS attach task ends (apache#39908) Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends. ``` 23:00:15 F20240824 22:56:49.773799 66432 thread_context.h:238] Check failed: doris::k_doris_exit || !doris::config::enable_memory_orphan_check || thread_mem_tracker()->label() != "Orphan" If you crash here, it means that SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the thread will crash. If you want to switch MemTrackerLimiter during thread execution, please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach. Of course, you can modify enable_memory_orphan_check=false in be.conf to avoid this crash. 23:00:15 *** Check failure stack trace: *** 23:00:15 @ 0x55645d3388e6 google::LogMessageFatal::~LogMessageFatal() 23:00:15 @ 0x5564439637c2 doris::ThreadContext::consume_memory() 23:00:15 @ 0x5564439914fe Allocator<>::release_memory() 23:00:15 @ 0x5564354be11e std::_Sp_counted_ptr<>::_M_dispose() 23:00:15 @ 0x55643557bc3b std::deque<>::pop_front() 23:00:15 @ 0x5564355756b1 doris::io::StreamLoadPipe::~StreamLoadPipe() 23:00:15 @ 0x5564354bfa77 doris::StreamLoadContext::~StreamLoadContext() 23:00:15 @ 0x556436ee5114 doris::HttpRequest::~HttpRequest() ```
Allocator save TLS MemTracker during first alloc, which is used to release memory after TLS attach task ends.