aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-08-08 14:36:47 +0200
committerGitHub <[email protected]>2023-08-08 14:36:47 +0200
commit9bd00e05b31e2ddb709b2afbc8569b7e4d767745 (patch)
tree382447f15b735c57cf0445e496f7c8943f83249d /src
parent0.2.14 (diff)
downloadzen-9bd00e05b31e2ddb709b2afbc8569b7e4d767745.tar.xz
zen-9bd00e05b31e2ddb709b2afbc8569b7e4d767745.zip
fix asserts and exceptions (#344)
* Send proper error to caller of GetChunkInfo instead of assert * catch and handle exceptions when checking for state_marker * properly wait for background tasks if oplop-export fails * changelog
Diffstat (limited to 'src')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp6
-rw-r--r--src/zenserver/projectstore/remoteprojectstore.cpp7
-rw-r--r--src/zenserver/zenserver.cpp13
3 files changed, 23 insertions, 3 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 184376c39..ae6f0d1d8 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -1952,7 +1952,11 @@ ProjectStore::GetChunkInfo(const std::string_view ProjectId,
IoHash RawHash;
uint64_t RawSize;
bool IsCompressed = CompressedBuffer::ValidateCompressedHeader(Chunk, RawHash, RawSize);
- ZEN_ASSERT(IsCompressed);
+ if (!IsCompressed)
+ {
+ return {HttpResponseCode::InternalServerError,
+ fmt::format("Chunk info request for malformed chunk id '{}/{}'/'{}'", ProjectId, OplogId, ChunkId)};
+ }
ChunkSize = RawSize;
}
diff --git a/src/zenserver/projectstore/remoteprojectstore.cpp b/src/zenserver/projectstore/remoteprojectstore.cpp
index c0fbad755..20acdf159 100644
--- a/src/zenserver/projectstore/remoteprojectstore.cpp
+++ b/src/zenserver/projectstore/remoteprojectstore.cpp
@@ -236,6 +236,13 @@ BuildContainer(CidStore& ChunkStore,
fmt::format("Failed to find attachment {} for op", AttachmentHash),
{});
ZEN_ERROR("Failed to build container ({}). Reason: '{}'", RemoteResult.GetError(), RemoteResult.GetErrorReason());
+
+ BlockCreateLatch.CountDown();
+ while (!BlockCreateLatch.Wait(1000))
+ {
+ ZEN_INFO("Aborting, {} blocks remaining...", BlockCreateLatch.Remaining());
+ }
+
return {};
}
uint64_t PayloadSize = Payload.GetSize();
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp
index 6ce49b1fe..6e636611d 100644
--- a/src/zenserver/zenserver.cpp
+++ b/src/zenserver/zenserver.cpp
@@ -571,9 +571,18 @@ public:
void CheckStateMarker()
{
std::filesystem::path StateMarkerPath = m_DataRoot / "state_marker";
- if (!std::filesystem::exists(StateMarkerPath))
+ try
+ {
+ if (!std::filesystem::exists(StateMarkerPath))
+ {
+ ZEN_WARN("state marker at {} has been deleted, exiting", StateMarkerPath);
+ RequestExit(1);
+ return;
+ }
+ }
+ catch (std::exception& Ex)
{
- ZEN_WARN("state marker at {} has been deleted, exiting", StateMarkerPath);
+ ZEN_WARN("state marker at {} could not be checked, reason: '{}'", StateMarkerPath, Ex.what());
RequestExit(1);
return;
}