You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/14 04:29:27 UTC
[doris] 06/13: [fix](memory leak) Fix load fragment `QueryFragmentsCtx` is not destroyed (#14840)
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 ef158238977d9247e966355ed3aadb4453f9d338
Author: Xinyi Zou <zo...@gmail.com>
AuthorDate: Wed Dec 7 08:45:53 2022 +0800
[fix](memory leak) Fix load fragment `QueryFragmentsCtx` is not destroyed (#14840)
---
be/src/runtime/query_fragments_ctx.h | 4 +++-
be/src/util/mem_info.cpp | 3 ++-
fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/be/src/runtime/query_fragments_ctx.h b/be/src/runtime/query_fragments_ctx.h
index 4bfff8c4da..fe327d0e7c 100644
--- a/be/src/runtime/query_fragments_ctx.h
+++ b/be/src/runtime/query_fragments_ctx.h
@@ -61,7 +61,9 @@ public:
}
}
- bool countdown() { return fragment_num.fetch_sub(1) == 1; }
+ // Notice. For load fragments, the fragment_num sent by FE has a small probability of 0.
+ // this may be a bug, bug <= 1 in theory it shouldn't cause any problems at this stage.
+ bool countdown() { return fragment_num.fetch_sub(1) <= 1; }
bool is_timeout(const DateTimeValue& now) const {
if (timeout_second <= 0) {
diff --git a/be/src/util/mem_info.cpp b/be/src/util/mem_info.cpp
index ebc51a7e0b..6a2f57cc4b 100644
--- a/be/src/util/mem_info.cpp
+++ b/be/src/util/mem_info.cpp
@@ -68,7 +68,8 @@ void MemInfo::refresh_allocator_mem() {
// https://jemalloc.net/jemalloc.3.html
_s_allocator_cache_mem =
- get_je_metrics(fmt::format("stats.arenas.{}.tcache_bytes", MALLCTL_ARENAS_ALL));
+ get_je_metrics(fmt::format("stats.arenas.{}.tcache_bytes", MALLCTL_ARENAS_ALL)) +
+ get_je_metrics("stats.metadata");
_s_allocator_cache_mem_str =
PrettyPrinter::print(static_cast<uint64_t>(_s_allocator_cache_mem), TUnit::BYTES);
_s_virtual_memory_used = get_je_metrics("stats.mapped");
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
index a89aa3ef42..7d32530eb6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
@@ -633,6 +633,7 @@ public class Coordinator {
profileFragmentId, tParam, this.addressToBackendID);
// Each tParam will set the total number of Fragments that need to be executed on the same BE,
// and the BE will determine whether all Fragments have been executed based on this information.
+ // Notice. load fragment has a small probability that FragmentNumOnHost is 0, for unknown reasons.
tParam.setFragmentNumOnHost(hostCounter.count(execState.address));
tParam.setBackendId(execState.backend.getId());
tParam.setNeedWaitExecutionTrigger(twoPhaseExecution);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org