From bec4dbd9bd995f73eab1ff803e7895187068ddb0 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Wed, 25 Oct 2023 17:38:28 +0200 Subject: just execute: fix race condition during garbage collection... ...of the internal cache used for keeping track of running operations. --- src/buildtool/execution_api/execution_service/operation_cache.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/buildtool/execution_api/execution_service/operation_cache.cpp') diff --git a/src/buildtool/execution_api/execution_service/operation_cache.cpp b/src/buildtool/execution_api/execution_service/operation_cache.cpp index 7fccdd41..1502016e 100644 --- a/src/buildtool/execution_api/execution_service/operation_cache.cpp +++ b/src/buildtool/execution_api/execution_service/operation_cache.cpp @@ -19,13 +19,11 @@ #include "google/protobuf/timestamp.pb.h" void OperationCache::GarbageCollection() { - std::shared_lock slock{mutex_}; if (cache_.size() > (threshold_ << 1U)) { std::vector> tmp; tmp.reserve(cache_.size()); std::copy(cache_.begin(), cache_.end(), std::back_insert_iterator(tmp)); - slock.release(); std::sort(tmp.begin(), tmp.end(), [](auto const& x, auto const& y) { ::google::protobuf::Timestamp tx; ::google::protobuf::Timestamp ty; @@ -35,7 +33,6 @@ void OperationCache::GarbageCollection() { }); std::size_t deleted = 0; - std::unique_lock ulock{mutex_}; for (auto const& [key, op] : tmp) { if (op.done()) { DropInternal(key); -- cgit v1.2.3