This is an automated email from the ASF dual-hosted git repository.
lgbo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 4cbcfa9bc9 Fix crash caused by not releasing QueryContext resources
properly (#10775)
4cbcfa9bc9 is described below
commit 4cbcfa9bc923e86986d23d1dd84e989320d9eedc
Author: lgbo <[email protected]>
AuthorDate: Mon Sep 22 19:49:20 2025 +0800
Fix crash caused by not releasing QueryContext resources properly (#10775)
---
cpp-ch/local-engine/Common/CHUtil.cpp | 1 +
cpp-ch/local-engine/Common/QueryContext.cpp | 5 +++++
cpp-ch/local-engine/Common/QueryContext.h | 3 +++
cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp | 2 --
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/cpp-ch/local-engine/Common/CHUtil.cpp
b/cpp-ch/local-engine/Common/CHUtil.cpp
index 55938082a3..907c4b58dd 100644
--- a/cpp-ch/local-engine/Common/CHUtil.cpp
+++ b/cpp-ch/local-engine/Common/CHUtil.cpp
@@ -1001,6 +1001,7 @@ void BackendFinalizerUtil::finalizeGlobally()
ReadBufferBuilderFactory::instance().clean();
StorageMergeTreeFactory::clear_cache_map();
QueryContext::resetGlobal();
+ QueryContext::instance().reset();
std::lock_guard lock(paths_mutex);
std::ranges::for_each(
paths_need_to_clean,
diff --git a/cpp-ch/local-engine/Common/QueryContext.cpp
b/cpp-ch/local-engine/Common/QueryContext.cpp
index e5c717a61f..9cc1b030ca 100644
--- a/cpp-ch/local-engine/Common/QueryContext.cpp
+++ b/cpp-ch/local-engine/Common/QueryContext.cpp
@@ -69,6 +69,11 @@ void QueryContext::resetGlobal()
Data::shared_context.reset();
}
+void QueryContext::reset()
+{
+ query_map_.clear();
+}
+
DB::ContextMutablePtr QueryContext::createGlobal()
{
assert(Data::shared_context.get() == nullptr);
diff --git a/cpp-ch/local-engine/Common/QueryContext.h
b/cpp-ch/local-engine/Common/QueryContext.h
index 6ced1f6320..74c4a69aee 100644
--- a/cpp-ch/local-engine/Common/QueryContext.h
+++ b/cpp-ch/local-engine/Common/QueryContext.h
@@ -48,6 +48,9 @@ public:
size_t currentPeakMemory(int64_t id);
void finalizeQuery(int64_t id);
+ // Clear resources held by the QueryContext instance.
+ void reset();
+
private:
QueryContext() = default;
LoggerPtr logger_ = getLogger("QueryContextManager");
diff --git a/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp
b/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp
index 7dcdbe6430..5aee654741 100644
--- a/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp
+++ b/cpp-ch/local-engine/Parser/RelParsers/GroupLimitRelParser.cpp
@@ -47,14 +47,12 @@
#include <QueryPipeline/QueryPipelineBuilder.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/wrappers.pb.h>
-#include "Common/Logger.h"
#include <Common/AggregateUtil.h>
#include <Common/ArrayJoinHelper.h>
#include <Common/GlutenConfig.h>
#include <Common/PlanUtil.h>
#include <Common/QueryContext.h>
#include <Common/logger_useful.h>
-#include "cctz/civil_time_detail.h"
namespace DB::ErrorCodes
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]