This is an automated email from the ASF dual-hosted git repository. lide pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-1.2-lts by this push: new ac57c1a6a4a [branch-1.2](bug) Fix heap-use-after-free in query cancelled by mem checker when process exceed memory limit #28092 ac57c1a6a4a is described below commit ac57c1a6a4a33bc76e7395026790e72c82ea27e0 Author: xy720 <22125576+xy...@users.noreply.github.com> AuthorDate: Thu Dec 7 12:10:15 2023 +0800 [branch-1.2](bug) Fix heap-use-after-free in query cancelled by mem checker when process exceed memory limit #28092 --- be/src/runtime/fragment_mgr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index 3bed90a59eb..9db12e533a1 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -698,7 +698,12 @@ Status FragmentMgr::exec_plan_fragment(const TExecPlanFragmentParams& params, Fi } } } - fragments_ctx->fragment_ids.push_back(fragment_instance_id); + { + // Need lock to protect fragment_ids vector, beacuse push_back may reallocate it. + // And it will be visited when the query is cancelled. + std::lock_guard<std::mutex> lock(_lock); + fragments_ctx->fragment_ids.push_back(fragment_instance_id); + } exec_state.reset(new FragmentExecState(fragments_ctx->query_id, params.params.fragment_instance_id, params.backend_num, --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org