diff options
| author | Dan Engelbrecht <[email protected]> | 2023-09-20 16:08:36 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-20 22:08:36 +0200 |
| commit | b29a0e1ec1e93e5acd97b8a78563268de38809f9 (patch) | |
| tree | d2dab69594dfb465186a339c32f2e5746b607aab | |
| parent | added info verb to vfs command help text (diff) | |
| download | zen-b29a0e1ec1e93e5acd97b8a78563268de38809f9.tar.xz zen-b29a0e1ec1e93e5acd97b8a78563268de38809f9.zip | |
controlled zenserver shutdown (#413)
* Do controlled shutdown of zenserver catching any exception thrown during shutdown
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | src/zenserver/zenserver.cpp | 56 |
2 files changed, 37 insertions, 21 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fe20dc4a..5cb85cb78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ ## - - Feature: Implemented virtual file system (VFS) support for debugging and introspection purposes - `zen vfs mount <path>` will initialize a virtual file system at the specified mount point. The mount point should ideally not exist already as the server can delete the entirety of it at exit or in other situations. Within the mounted tree you will find directories which allow you to enumerate contents of DDC and the project store - `zen vfs unmount` will stop the VFS - `zen vfs info` can be used to check the status of the VFS +- Bugfix: Do controlled shut down order of zenserver and catch exceptions thrown during shutdown ## 0.2.23 - Bugfix: Respect result from FinalizeRef in Jupiter oplog upload where it requests missing attachments diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp index 1f37e336f..921e3038d 100644 --- a/src/zenserver/zenserver.cpp +++ b/src/zenserver/zenserver.cpp @@ -226,14 +226,7 @@ namespace utils { class ZenServer : public IHttpStatusProvider { public: - ~ZenServer() - { - m_IoContext.stop(); - if (m_IoRunner.joinable()) - { - m_IoRunner.join(); - } - } + ~ZenServer() {} int Initialize(const ZenServerOptions& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry) { @@ -503,18 +496,7 @@ public: ZEN_INFO(ZEN_APP_NAME " exiting"); - m_IoContext.stop(); - if (m_IoRunner.joinable()) - { - m_IoRunner.join(); - } - Flush(); - - if (m_JobQueue) - { - m_JobQueue->Stop(); - } } void RequestExit(int ExitCode) @@ -531,11 +513,45 @@ public: ZEN_INFO(ZEN_APP_NAME " cleaning up"); try { - m_GcScheduler.Shutdown(); + m_IoContext.stop(); + if (m_IoRunner.joinable()) + { + m_IoRunner.join(); + } + if (m_Http) { m_Http->Close(); } + if (m_JobQueue) + { + m_JobQueue->Stop(); + } + + m_GcScheduler.Shutdown(); + m_AdminService.reset(); + m_VfsService.reset(); + m_ObjStoreService.reset(); + m_FrontendService.reset(); + + m_StructuredCacheService.reset(); + m_UpstreamService.reset(); + m_UpstreamCache.reset(); + m_CacheStore = {}; + +#if ZEN_WITH_COMPUTE_SERVICES + m_HttpFunctionService.reset(); +#endif // ZEN_WITH_COMPUTE_SERVICES + + m_HttpProjectService.reset(); + m_ProjectStore = {}; + m_CidService.reset(); + m_CidStore.reset(); + m_AuthService.reset(); + m_AuthMgr.reset(); + m_WebSocket.reset(); + m_Http = {}; + m_JobQueue.reset(); } catch (std::exception& Ex) { |