This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new fbf9f623c32 [fix](dns-cache) do not detach the refresh thread #33182 
(#33184)
fbf9f623c32 is described below

commit fbf9f623c325205a6359ee4c94ce1c9e5bb07f45
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Wed Apr 3 09:21:42 2024 +0800

    [fix](dns-cache) do not detach the refresh thread #33182 (#33184)
---
 be/src/runtime/exec_env_init.cpp | 4 +++-
 be/src/util/dns_cache.cpp        | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index b31e97febb7..48f1fc0651b 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -386,7 +386,6 @@ void ExecEnv::_destroy() {
     if (!_is_init) {
         return;
     }
-    SAFE_DELETE(_dns_cache);
 
     _deregister_metrics();
     SAFE_DELETE(_internal_client_cache);
@@ -429,6 +428,9 @@ void ExecEnv::_destroy() {
     InvertedIndexSearcherCache::reset_global_instance();
 
     SAFE_DELETE(_runtime_query_statistics_mgr);
+
+    // dns cache is a global instance and need to be released at last
+    SAFE_DELETE(_dns_cache);
     _is_init = false;
 }
 
diff --git a/be/src/util/dns_cache.cpp b/be/src/util/dns_cache.cpp
index f2bd4ce91e6..fc7e88b3c1c 100644
--- a/be/src/util/dns_cache.cpp
+++ b/be/src/util/dns_cache.cpp
@@ -24,7 +24,6 @@ namespace doris {
 
 DNSCache::DNSCache() {
     refresh_thread = std::thread(&DNSCache::_refresh_cache, this);
-    refresh_thread.detach();
 }
 
 DNSCache::~DNSCache() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to