This is an automated email from the ASF dual-hosted git repository. michaelsmith pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push: new c78f7a729 IMPALA-14392: Fix a crash in AdmissionD in GetQueryStatus PrintId() c78f7a729 is described below commit c78f7a72902c7e96ed86d3344186ba8bdeb03520 Author: Yida Wu <yida...@cloudera.com> AuthorDate: Wed Sep 3 17:17:48 2025 -0700 IMPALA-14392: Fix a crash in AdmissionD in GetQueryStatus PrintId() The GetQueryStatus RPC could crash due to a use-after-free error when accessing the reqest. When a query was rejected, the function would call RespondAndReleaseRpc(), which can free the "req" object, and then attempt to access req->query_id() for logging and to delete the entry from the admission_state_map_. This commit fixes the crash by moving the call to RespondAndReleaseRpc() to the end of the function. This change aligns this function with others like AdmissionControlService::ReleaseQuery(), which also deletes from admission_state_map_ before RespondAndReleaseRpc(), it ensures that all logic is completed before the RPC resources are released. Tests: Reproduced the issue by running 100 times TestAdmissionControllerStressWithACService::test_mem_limit, and after the change, it can successfully run 100 times. Passed exhaustive tests. Change-Id: I688954c5c671671cc2dc669ecfdf2405476302d7 Reviewed-on: http://gerrit.cloudera.org:8080/23379 Reviewed-by: Michael Smith <michael.sm...@cloudera.com> Tested-by: Michael Smith <michael.sm...@cloudera.com> --- be/src/scheduling/admission-control-service.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/scheduling/admission-control-service.cc b/be/src/scheduling/admission-control-service.cc index be6c33bd0..f39a3c6b9 100644 --- a/be/src/scheduling/admission-control-service.cc +++ b/be/src/scheduling/admission-control-service.cc @@ -211,7 +211,6 @@ void AdmissionControlService::GetQueryStatus(const GetQueryStatusRequestPB* req, } } - RespondAndReleaseRpc(status, resp, rpc_context); if (admission_state->admission_done && !admission_state->admit_status.ok()) { LOG(INFO) << "Query " << req->query_id() << " was rejected. Removing admission state to free resources."; @@ -222,6 +221,7 @@ void AdmissionControlService::GetQueryStatus(const GetQueryStatusRequestPB* req, discard_result(admission_state_map_.Delete(req->query_id())); VLOG(3) << "Current admission state map size: " << admission_state_map_.Count(); } + RespondAndReleaseRpc(status, resp, rpc_context); } void AdmissionControlService::ReleaseQuery(const ReleaseQueryRequestPB* req,