aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/hub/hubservice.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-02-24 13:23:52 +0100
committerStefan Boberg <[email protected]>2026-02-24 13:27:53 +0100
commit3c89c486338890ce39ddebe5be4722a09e85701a (patch)
tree1382d8e81683072f7cb3a7505e6af3bda7cd0312 /src/zenserver/hub/hubservice.cpp
parentimplement yaml generation (#774) (diff)
downloadzen-3c89c486338890ce39ddebe5be4722a09e85701a.tar.xz
zen-3c89c486338890ce39ddebe5be4722a09e85701a.zip
Fix correctness and concurrency bugs found during code review
zenstore fixes: - cas.cpp: GetFileCasResults Results param passed by value instead of reference (large chunk results were silently lost) - structuredcachestore.cpp: MissCount unconditionally incremented (counted hits as misses) - cacherpc.cpp: Wrong boolean in Incomplete response array (all entries marked incomplete) - cachedisklayer.cpp: sizeof(sizeof(...)) in two validation checks computed sizeof(size_t) instead of struct size - buildstore.cpp: Wrong hash tracked in GC key list (BlobHash pushed twice instead of MetadataHash) - buildstore.cpp: Removed duplicate m_LastAccessTimeUpdateCount increment in PutBlob zenserver fixes: - httpbuildstore.cpp: Reversed subtraction in HTTP range calculation (unsigned underflow) - hubservice.cpp: Deadlock in Provision() calling Wake() while holding m_Lock (extracted WakeLocked helper) - zipfs.cpp: Data race in GetFile() lazy initialization (added RwLock with shared/exclusive paths) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Diffstat (limited to 'src/zenserver/hub/hubservice.cpp')
-rw-r--r--src/zenserver/hub/hubservice.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/zenserver/hub/hubservice.cpp b/src/zenserver/hub/hubservice.cpp
index 4d9da3a57..a00446a75 100644
--- a/src/zenserver/hub/hubservice.cpp
+++ b/src/zenserver/hub/hubservice.cpp
@@ -151,6 +151,7 @@ struct StorageServerInstance
inline uint16_t GetBasePort() const { return m_ServerInstance.GetBasePort(); }
private:
+ void WakeLocked();
RwLock m_Lock;
std::string m_ModuleId;
std::atomic<bool> m_IsProvisioned{false};
@@ -211,7 +212,7 @@ StorageServerInstance::Provision()
if (m_IsHibernated)
{
- Wake();
+ WakeLocked();
}
else
{
@@ -294,9 +295,14 @@ StorageServerInstance::Hibernate()
void
StorageServerInstance::Wake()
{
- // Start server in-place using existing data
-
RwLock::ExclusiveLockScope _(m_Lock);
+ WakeLocked();
+}
+
+void
+StorageServerInstance::WakeLocked()
+{
+ // Start server in-place using existing data
if (!m_IsHibernated)
{