aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-09-29 12:39:42 +0200
committerGitHub Enterprise <[email protected]>2025-09-29 12:39:42 +0200
commit1d1c14ca657523abaf5807821f6961f3868ad4e0 (patch)
tree6260f6c6653cc29ceb9312b49067c2ab15aa1dc5
parentGetCacheChunk value request respects RawHash (#518) (diff)
downloadzen-1d1c14ca657523abaf5807821f6961f3868ad4e0.tar.xz
zen-1d1c14ca657523abaf5807821f6961f3868ad4e0.zip
fix race condition in BlockStoreFile::Flush (#525)
Bugfix: Flush of blockstore file could sometimes cause an error due to a race condition
-rw-r--r--CHANGELOG.md2
-rw-r--r--src/zenstore/blockstore.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ab62e9bc8..26acdb172 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,10 @@
##
+
- Bugfix: Fixed invalid namespace+bucket regexes in BuildStore (only fired with new MSVC compiler)
- Bugfix: `GcScheduler` could delay shutdown in some situations
- Bugfix: On exit, trace shutdown can happen before all threads completed their TLS cleanup
- Bugfix: When requesting a value via the GetCacheChunks rpc method, if the request specified a raw hash, only return a hit if the raw hash matches what was in the cache
+- Bugfix: Flush of blockstore file could sometimes cause an error due to a race condition
## 5.7.2
- Feature: Added `--force` option to `zen builds download` command that forces download of all content ignoring any local state
diff --git a/src/zenstore/blockstore.cpp b/src/zenstore/blockstore.cpp
index b8fa03305..ec7924553 100644
--- a/src/zenstore/blockstore.cpp
+++ b/src/zenstore/blockstore.cpp
@@ -171,9 +171,9 @@ BlockStoreFile::Flush(uint64_t FinalSize)
if (FinalSize != (uint64_t)-1)
{
uint64_t ExpectedSize = 0;
- if (!m_CachedFileSize.compare_exchange_weak(ExpectedSize, FinalSize))
+ while (!m_CachedFileSize.compare_exchange_weak(ExpectedSize, FinalSize))
{
- ZEN_ASSERT(m_CachedFileSize.load() == FinalSize);
+ ZEN_ASSERT(ExpectedSize <= FinalSize);
}
}
}