diff options
| author | Dan Engelbrecht <[email protected]> | 2024-03-18 11:32:54 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-03-18 11:32:54 +0100 |
| commit | c1eb25151f84b93e5eef6a74842476c016eceb1d (patch) | |
| tree | 15b8c4b0ed8b4d9e57b5307cb368bf646e0a56ea | |
| parent | make sure zenserver reacts and exist on SIGTERM signal (#8) (diff) | |
| download | zen-c1eb25151f84b93e5eef6a74842476c016eceb1d.tar.xz zen-c1eb25151f84b93e5eef6a74842476c016eceb1d.zip | |
add a retry when trying to create the lock file (#9)
* add a retry when trying to create the lock file if UE is trying to read it at the same time
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenserver/main.cpp | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 79cf0c050..a163129b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - Improvement: Added support for request tracing when using asio path (use `--log-trace=http_requests` to enable) - Improvement: Large attachments and loose files are now split into smaller chunks and stored in blocks during oplog export - Improvement: Make sure zenserver reacts and exist on SIGTERM signal +- Improvement: Retry to create the .lock file at startup to avoid failing launch due to race condition with UE - Removed: `--cache-reference-cache-enabled` option has been removed along with the implementation for reference caching in disk cache ## 5.4.1 diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index 01e142801..b4cb2464b 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -145,9 +145,15 @@ ZenEntryPoint::Run() if (Ec) { - ZEN_WARN("ERROR: Unable to grab lock at '{}' (error: '{}')", LockFilePath, Ec.message()); + ZEN_WARN("Unable to grab lock at '{}' (error: '{}'), retrying", LockFilePath, Ec.message()); + Sleep(500); - std::exit(99); + m_LockFile.Create(LockFilePath, MakeLockData(), Ec); + if (Ec) + { + ZEN_WARN("ERROR: Unable to grab lock at '{}' (error: '{}')", LockFilePath, Ec.message()); + std::exit(99); + } } InitializeServerLogging(m_ServerOptions); |