diff options
| author | Dan Engelbrecht <[email protected]> | 2023-08-08 14:36:47 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-08 14:36:47 +0200 |
| commit | 9bd00e05b31e2ddb709b2afbc8569b7e4d767745 (patch) | |
| tree | 382447f15b735c57cf0445e496f7c8943f83249d | |
| parent | 0.2.14 (diff) | |
| download | zen-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
| -rw-r--r-- | CHANGELOG.md | 5 | ||||
| -rw-r--r-- | src/zenserver/projectstore/projectstore.cpp | 6 | ||||
| -rw-r--r-- | src/zenserver/projectstore/remoteprojectstore.cpp | 7 | ||||
| -rw-r--r-- | src/zenserver/zenserver.cpp | 13 |
4 files changed, 28 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 16903af33..eb50600f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ ## +- Bugfix: If `oplog-export` fails while creating blocks, wait for background jobs to finish before aborting to avoid crash +- Bugfix: If `GetChunkInfo` in project store finds a chunk in the wrong format, return a readable error instead of ASSERT +- Bugfix: If checking for state_marker throws exception, exit gracefully rather than throw exception + +## 0.1.14 - Feature: Added `zen serve` command for establishing a link to a directory tree for use with staged UE builds and the `-Mount=` option - Bugfix: Make sure to validate return pointer when calling Memory::Alloc in all locations - Bugfix: Log error instead of hard crash if GC scheduler thread throws exception 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; } |