diff options
author | alexvru <[email protected]> | 2023-03-27 19:20:23 +0300 |
---|---|---|
committer | alexvru <[email protected]> | 2023-03-27 19:20:23 +0300 |
commit | 56b7262ee8bdde6d26a2bddccddab8d7e6c6d207 (patch) | |
tree | 384988e30f69575005ec443bb401be84d4f18afc | |
parent | c4b49cafa22282346c95d36d1ed887467b03eab1 (diff) |
Fix BlobDepot agent teardown bug
-rw-r--r-- | ydb/core/blob_depot/agent/agent_impl.h | 2 | ||||
-rw-r--r-- | ydb/core/blob_depot/agent/blob_mapping_cache.cpp | 8 | ||||
-rw-r--r-- | ydb/core/blob_depot/agent/blob_mapping_cache.h | 1 |
3 files changed, 7 insertions, 4 deletions
diff --git a/ydb/core/blob_depot/agent/agent_impl.h b/ydb/core/blob_depot/agent/agent_impl.h index 21642cf8da3..c49b7c9ffae 100644 --- a/ydb/core/blob_depot/agent/agent_impl.h +++ b/ydb/core/blob_depot/agent/agent_impl.h @@ -465,7 +465,7 @@ namespace NKikimr::NBlobDepot { // Blob mapping cache class TBlobMappingCache; - std::unique_ptr<TBlobMappingCache> BlobMappingCachePtr; + std::shared_ptr<TBlobMappingCache> BlobMappingCachePtr; TBlobMappingCache& BlobMappingCache; //////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/ydb/core/blob_depot/agent/blob_mapping_cache.cpp b/ydb/core/blob_depot/agent/blob_mapping_cache.cpp index 77800af63a4..f3150047bad 100644 --- a/ydb/core/blob_depot/agent/blob_mapping_cache.cpp +++ b/ydb/core/blob_depot/agent/blob_mapping_cache.cpp @@ -116,9 +116,11 @@ namespace NKikimr::NBlobDepot { const ui64 id = Agent.NextOtherRequestId++; const bool inserted1 = entry.PendingQueries.emplace(id, mustRestoreFirst).second; Y_VERIFY(inserted1); - auto cancelCallback = [&entry, id] { - const size_t numErased = entry.PendingQueries.erase(id); - Y_VERIFY(numErased); + auto cancelCallback = [&entry, id, self = weak_from_this()] { + if (!self.expired()) { + const size_t numErased = entry.PendingQueries.erase(id); + Y_VERIFY(numErased); + } }; Agent.RegisterRequest(id, query, std::move(context), std::move(cancelCallback), false); diff --git a/ydb/core/blob_depot/agent/blob_mapping_cache.h b/ydb/core/blob_depot/agent/blob_mapping_cache.h index 57aaa3ff4c1..45f16e7e9a2 100644 --- a/ydb/core/blob_depot/agent/blob_mapping_cache.h +++ b/ydb/core/blob_depot/agent/blob_mapping_cache.h @@ -7,6 +7,7 @@ namespace NKikimr::NBlobDepot { class TBlobDepotAgent::TBlobMappingCache : public TRequestSender + , public std::enable_shared_from_this<TBlobMappingCache> { struct TCachedKeyItem : TIntrusiveListItem<TCachedKeyItem> { TStringBuf Key; // key buffer (view of key part of the Cache set) |