aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-06-16 13:17:37 +0200
committerGitHub Enterprise <[email protected]>2025-06-16 13:17:37 +0200
commit2dbfa547abd7f9e393cb63f9c70de15d91de2815 (patch)
tree722191023ae6eef544b1672562f6c0e4309e1756 /src
parentsentry config (#430) (diff)
downloadzen-2dbfa547abd7f9e393cb63f9c70de15d91de2815.tar.xz
zen-2dbfa547abd7f9e393cb63f9c70de15d91de2815.zip
fix build store range check (#437)
* fix range check for blob store fetch * don't try to parse blockdesriptions if empty result is returned * add range to log when fetching blob range fails
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/builds_cmd.cpp11
-rw-r--r--src/zenserver/buildstore/httpbuildstore.cpp2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp
index abb4bfe0c..706fdf9ba 100644
--- a/src/zen/cmds/builds_cmd.cpp
+++ b/src/zen/cmds/builds_cmd.cpp
@@ -3503,7 +3503,11 @@ namespace {
{
ZEN_TRACE_CPU("FindBlocks");
Stopwatch KnownBlocksTimer;
- Result.KnownBlocks = ParseChunkBlockDescriptionList(Storage.BuildStorage->FindBlocks(BuildId, FindBlockMaxCount));
+ CbObject BlockDescriptionList = Storage.BuildStorage->FindBlocks(BuildId, FindBlockMaxCount);
+ if (BlockDescriptionList)
+ {
+ Result.KnownBlocks = ParseChunkBlockDescriptionList(BlockDescriptionList);
+ }
FindBlocksStats.FindBlockTimeMS = KnownBlocksTimer.GetElapsedTimeMs();
FindBlocksStats.FoundBlockCount = Result.KnownBlocks.size();
Result.FindBlocksTimeMs = KnownBlocksTimer.GetElapsedTimeMs();
@@ -7440,7 +7444,10 @@ namespace {
}
if (!BlockBuffer)
{
- throw std::runtime_error(fmt::format("Block {} is missing", BlockDescription.BlockHash));
+ throw std::runtime_error(fmt::format("Block {} is missing when fetching range {} -> {}",
+ BlockDescription.BlockHash,
+ BlockRange.RangeStart,
+ BlockRange.RangeStart + BlockRange.RangeLength));
}
if (!AbortFlag)
{
diff --git a/src/zenserver/buildstore/httpbuildstore.cpp b/src/zenserver/buildstore/httpbuildstore.cpp
index 75a333687..bcec74ce6 100644
--- a/src/zenserver/buildstore/httpbuildstore.cpp
+++ b/src/zenserver/buildstore/httpbuildstore.cpp
@@ -177,7 +177,7 @@ HttpBuildStoreService::GetBlobRequest(HttpRouterRequest& Req)
const uint64_t BlobSize = Blob.GetSize();
const uint64_t MaxBlobSize = Range.Start < BlobSize ? Range.Start - BlobSize : 0;
const uint64_t RangeSize = Min(Range.End - Range.Start + 1, MaxBlobSize);
- if (Range.Start + RangeSize >= BlobSize)
+ if (Range.Start + RangeSize > BlobSize)
{
return ServerRequest.WriteResponse(HttpResponseCode::NoContent);
}