aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-09-13 11:20:01 -0400
committerGitHub <[email protected]>2023-09-13 17:20:01 +0200
commit8af7c6855591d5592a26cf9a63aae90b79857184 (patch)
tree3f8879510f81b1012a679c1fae6d6006bb7a61b6
parentfix url parsing crash (#399) (diff)
downloadzen-8af7c6855591d5592a26cf9a63aae90b79857184.tar.xz
zen-8af7c6855591d5592a26cf9a63aae90b79857184.zip
issue warning instead of assert on bad data in cid store (#400)
* issue warning instead of assert on bad data in cid store
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenserver/cache/httpstructuredcache.cpp24
2 files changed, 15 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9f5fe82f..dbc3d46dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- Feature: Added `--cache-write-log` and `--cache-access-log` command line option to enable/disable cache write/access logs
- Bugfix: Make sure cache logging thread does not crash on errors
- Bugfix: Make sure error logging or destructors don't throw exception when trying to get file name from handle
+- Bugfix: Issue warning instead of assert on bad data in cid store
- Bugfix: Don't index out of string_view range when parsing URI in httpsys
- Improvement: Sorting attachments in oplog blocks based on Op key to group op attachments together
- Improvement: Don't split attachments associated with the same op across oplog blocks
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;
}
}
}