From 1b2db666e25e65725d0ac65027150ca1776dd022 Mon Sep 17 00:00:00 2001 From: zhengyu Date: Thu, 12 Jun 2025 21:36:39 +0800 Subject: [PATCH] [fix](filecache) fix load_cache_info_into_memory crash keep _storage last so it will deconstruct first otherwise, load_cache_info_into_memory might crash coz it will use other members of BlockFileCache so join this async load thread first Signed-off-by: zhengyu --- be/src/io/cache/block_file_cache.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/be/src/io/cache/block_file_cache.h b/be/src/io/cache/block_file_cache.h index a64d339d081be6..c12b03cc998792 100644 --- a/be/src/io/cache/block_file_cache.h +++ b/be/src/io/cache/block_file_cache.h @@ -496,7 +496,6 @@ class BlockFileCache { size_t _max_query_cache_size = 0; mutable std::mutex _mutex; - std::unique_ptr _storage; bool _close {false}; std::mutex _close_mtx; std::condition_variable _close_cv; @@ -575,6 +574,11 @@ class BlockFileCache { std::shared_ptr _evict_in_advance_latency_us; std::shared_ptr _recycle_keys_length_recorder; std::shared_ptr _ttl_gc_latency_us; + // keep _storage last so it will deconstruct first + // otherwise, load_cache_info_into_memory might crash + // coz it will use other members of BlockFileCache + // so join this async load thread first + std::unique_ptr _storage; }; } // namespace doris::io