diff options
author | alexvru <alexvru@ydb.tech> | 2023-03-27 10:35:22 +0300 |
---|---|---|
committer | alexvru <alexvru@ydb.tech> | 2023-03-27 10:35:22 +0300 |
commit | 0701f0ff1650f8603ab263c2c1ea1ca26be89ef7 (patch) | |
tree | 4bd5f3323917e0479bac50a31820805bdc1b02e6 | |
parent | e9228dd5e62ad44b1a683860b029a81250fb6ec7 (diff) | |
download | ydb-0701f0ff1650f8603ab263c2c1ea1ca26be89ef7.tar.gz |
Fix BlobDepot agent query leak
-rw-r--r-- | ydb/core/blob_depot/agent/agent_impl.h | 2 | ||||
-rw-r--r-- | ydb/core/blob_depot/agent/query.cpp | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/ydb/core/blob_depot/agent/agent_impl.h b/ydb/core/blob_depot/agent/agent_impl.h index 33d559a150a..21642cf8da3 100644 --- a/ydb/core/blob_depot/agent/agent_impl.h +++ b/ydb/core/blob_depot/agent/agent_impl.h @@ -396,9 +396,9 @@ namespace NKikimr::NBlobDepot { size_t PendingEventBytes = 0; static constexpr size_t MaxPendingEventBytes = 32'000'000; // ~32 MB static constexpr TDuration EventExpirationTime = TDuration::Seconds(60); + std::multimap<TMonotonic, TQuery*> QueryWatchdogMap; TIntrusiveListWithAutoDelete<TQuery, TQuery::TDeleter, TExecutingQueries> ExecutingQueries; TIntrusiveListWithAutoDelete<TQuery, TQuery::TDeleter, TExecutingQueries> DeletePendingQueries; - std::multimap<TMonotonic, TQuery*> QueryWatchdogMap; bool ProcessPendingEventInFlight = false; template<ui32 EventType> TQuery *CreateQuery(std::unique_ptr<IEventHandle> ev); diff --git a/ydb/core/blob_depot/agent/query.cpp b/ydb/core/blob_depot/agent/query.cpp index 6ea304c0d15..02ea21d96d6 100644 --- a/ydb/core/blob_depot/agent/query.cpp +++ b/ydb/core/blob_depot/agent/query.cpp @@ -146,13 +146,11 @@ namespace NKikimr::NBlobDepot { , QueryId(RandomNumber<ui64>()) , StartTime(TActivationContext::Monotonic()) , QueryWatchdogMapIter(agent.QueryWatchdogMap.emplace(StartTime + WatchdogDuration, this)) - {} + { + agent.ExecutingQueries.PushBack(this); + } TBlobDepotAgent::TQuery::~TQuery() { - if (TDuration duration(TActivationContext::Monotonic() - StartTime); duration >= WatchdogDuration) { - STLOG(WatchdogPriority, BLOB_DEPOT_AGENT, BDA00, "query execution took too much time", - (AgentId, Agent.LogId), (QueryId, GetQueryId()), (Duration, duration)); - } Agent.QueryWatchdogMap.erase(QueryWatchdogMapIter); } @@ -218,6 +216,11 @@ namespace NKikimr::NBlobDepot { TIntrusiveListItem<TQuery, TPendingId>::Unlink(); Agent.DeletePendingQueries.PushBack(this); TRequestSender::ClearRequestsInFlight(); + + if (TDuration duration(TActivationContext::Monotonic() - StartTime); duration >= WatchdogDuration) { + STLOG(WatchdogPriority, BLOB_DEPOT_AGENT, BDA00, "query execution took too much time", + (AgentId, Agent.LogId), (QueryId, GetQueryId()), (Duration, duration)); + } } TString TBlobDepotAgent::TQuery::GetQueryId() const { |