From d3c9880bbef34dd412207da6ed2e5b3caeed536a Mon Sep 17 00:00:00 2001 From: meegoo Date: Tue, 24 Dec 2024 18:26:36 -0800 Subject: [PATCH] [BugFix] Fix load query_mem_tracker leak (#54242) Signed-off-by: meegoo --- be/src/exec/tablet_sink_index_channel.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/be/src/exec/tablet_sink_index_channel.cpp b/be/src/exec/tablet_sink_index_channel.cpp index 70f737ce6920e..17ee266d7167d 100644 --- a/be/src/exec/tablet_sink_index_channel.cpp +++ b/be/src/exec/tablet_sink_index_channel.cpp @@ -628,9 +628,14 @@ Status NodeChannel::_send_request(bool eos, bool finished) { AddMultiChunkReq add_chunk = std::move(_request_queue.front()); _request_queue.pop_front(); - auto request = add_chunk.second; auto chunk = std::move(add_chunk.first); + // reset mem tracker since we don't want to send the brpc request under query_mem_tracker + // and the memory usage of the request is recorded by the olap_sink's mem tracker + SCOPED_THREAD_LOCAL_MEM_TRACKER_SETTER(nullptr); + + auto request = add_chunk.second; + _mem_tracker->release(chunk->memory_usage()); RETURN_IF_ERROR(_wait_one_prev_request());