From 1ce8f1383770b79a8a2e25e96f6b6ff90562e8bf Mon Sep 17 00:00:00 2001 From: Xinyi Zou Date: Thu, 15 Jun 2023 10:35:25 +0800 Subject: [PATCH] [fix](memory) fix mem tracker in NodeChannel rpc callback (#20779) --- be/src/vec/sink/vtablet_sink.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/vec/sink/vtablet_sink.cpp b/be/src/vec/sink/vtablet_sink.cpp index 799e3a83a2..b766de1b8a 100644 --- a/be/src/vec/sink/vtablet_sink.cpp +++ b/be/src/vec/sink/vtablet_sink.cpp @@ -409,13 +409,13 @@ Status VNodeChannel::open_wait() { // add block closure _add_block_closure = ReusableClosure::create(); _add_block_closure->addFailedHandler([this](bool is_last_rpc) { - SCOPED_ATTACH_TASK(_state); std::lock_guard l(this->_closed_lock); if (this->_is_closed) { // if the node channel is closed, no need to call `mark_as_failed`, // and notice that _index_channel may already be destroyed. return; } + SCOPED_ATTACH_TASK(_state); // If rpc failed, mark all tablets on this node channel as failed _index_channel->mark_as_failed(this->node_id(), this->host(), fmt::format("rpc failed, error coed:{}, error text:{}", @@ -434,13 +434,13 @@ Status VNodeChannel::open_wait() { _add_block_closure->addSuccessHandler([this](const PTabletWriterAddBlockResult& result, bool is_last_rpc) { - SCOPED_ATTACH_TASK(_state); std::lock_guard l(this->_closed_lock); if (this->_is_closed) { // if the node channel is closed, no need to call the following logic, // and notice that _index_channel may already be destroyed. return; } + SCOPED_ATTACH_TASK(_state); Status status(result.status()); if (status.ok()) { // if has error tablet, handle them first