From 8af7c6855591d5592a26cf9a63aae90b79857184 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 13 Sep 2023 11:20:01 -0400 Subject: issue warning instead of assert on bad data in cid store (#400) * issue warning instead of assert on bad data in cid store --- src/zenserver/cache/httpstructuredcache.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/zenserver/cache/httpstructuredcache.cpp') diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index 9bc8d865a..ddfd1eeb5 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -2061,19 +2061,23 @@ HttpStructuredCacheService::HandleRpcGetCacheRecords(const CacheRequestContext& { if (IoBuffer Chunk = m_CidStore.FindChunkByCid(Value.ContentId)) { - ZEN_ASSERT(Chunk.GetSize() > 0); - Value.Payload = CompressedBuffer::FromCompressedNoValidate(std::move(Chunk)); - Value.Exists = true; - } - else - { - if (EnumHasAllFlags(ValuePolicy, CachePolicy::QueryRemote)) + if (Chunk.GetSize() > 0) { - NeedUpstreamAttachment = true; - Value.ReadFromUpstream = true; + Value.Payload = CompressedBuffer::FromCompressedNoValidate(std::move(Chunk)); + Value.Exists = true; + continue; + } + else + { + ZEN_WARN("Skipping invalid chunk in local cache '{}'", Value.ContentId); } - Request.Complete = false; } + if (EnumHasAllFlags(ValuePolicy, CachePolicy::QueryRemote)) + { + NeedUpstreamAttachment = true; + Value.ReadFromUpstream = true; + } + Request.Complete = false; } } } -- cgit v1.2.3