This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit ae5dfa96896759a1b01a49cf62e7f79eed5478a7 Author: weizuo93 <[email protected]> AuthorDate: Mon Feb 6 15:52:17 2023 +0800 [Fix](load) Fix memory leak for stream load 2pc #16430 StreamLoadContext is not deleted correctly. Co-authored-by: weizuo <[email protected]> --- be/src/http/action/stream_load_2pc.cpp | 14 ++++++++++++++ be/src/http/action/stream_load_2pc.h | 1 + 2 files changed, 15 insertions(+) diff --git a/be/src/http/action/stream_load_2pc.cpp b/be/src/http/action/stream_load_2pc.cpp index 626025d334..bcc4d9f288 100644 --- a/be/src/http/action/stream_load_2pc.cpp +++ b/be/src/http/action/stream_load_2pc.cpp @@ -93,4 +93,18 @@ std::string StreamLoad2PCAction::get_success_info(const std::string txn_id, return s.GetString(); } +void StreamLoad2PCAction::free_handler_ctx(void* param) { + StreamLoadContext* ctx = (StreamLoadContext*)param; + if (ctx == nullptr) { + return; + } + // sender is gone, make receiver know it + if (ctx->body_sink != nullptr) { + ctx->body_sink->cancel("sender is gone"); + } + if (ctx->unref()) { + delete ctx; + } +} + } // namespace doris diff --git a/be/src/http/action/stream_load_2pc.h b/be/src/http/action/stream_load_2pc.h index 304e6a902f..431e2aa6e0 100644 --- a/be/src/http/action/stream_load_2pc.h +++ b/be/src/http/action/stream_load_2pc.h @@ -33,6 +33,7 @@ public: void handle(HttpRequest* req) override; std::string get_success_info(const std::string txn_id, const std::string txn_operation); + void free_handler_ctx(void* param) override; private: ExecEnv* _exec_env; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
