From b8c2dd888a167293b923145ca0ab29cd1fdba948 Mon Sep 17 00:00:00 2001 From: Roman Gershman Date: Fri, 22 Nov 2024 11:40:10 +0200 Subject: [PATCH] chore: log exit code of failing dragonfly in tests (#4166) Signed-off-by: Roman Gershman --- src/server/dfly_main.cc | 10 ++++------ tests/dragonfly/instance.py | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/dfly_main.cc b/src/server/dfly_main.cc index 513243948e01..0dff2cf8e1ff 100644 --- a/src/server/dfly_main.cc +++ b/src/server/dfly_main.cc @@ -165,12 +165,12 @@ template unique_ptr MakeListener(Args&&... args) { return res; } -bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) { +void RunEngine(ProactorPool* pool, AcceptServer* acceptor) { uint64_t maxmemory = GetMaxMemoryFlag(); if (maxmemory > 0 && maxmemory < pool->size() * 256_MB) { LOG(ERROR) << "There are " << pool->size() << " threads, so " << HumanReadableNumBytes(pool->size() * 256_MB) << " are required. Exiting..."; - return false; + exit(1); } Service service(pool); @@ -310,8 +310,6 @@ bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) { version_monitor.Shutdown(); service.Shutdown(); - - return true; } bool CreatePidFile(const string& path) { @@ -791,7 +789,7 @@ Usage: dragonfly [FLAGS] AcceptServer acceptor(pool.get(), &fb2::std_malloc_resource, true); acceptor.set_back_log(absl::GetFlag(FLAGS_tcp_backlog)); - int res = dfly::RunEngine(pool.get(), &acceptor) ? 0 : -1; + dfly::RunEngine(pool.get(), &acceptor); pool->Stop(); @@ -803,5 +801,5 @@ Usage: dragonfly [FLAGS] // This is a workaround for a bug in mi_malloc that may cause a crash on exit. mi_collect(true); - return res; + return 0; } diff --git a/tests/dragonfly/instance.py b/tests/dragonfly/instance.py index c515ad07476f..f391f81a87bf 100644 --- a/tests/dragonfly/instance.py +++ b/tests/dragonfly/instance.py @@ -234,7 +234,9 @@ def stop(self, kill=False): # if the return code is negative it means termination by signal # if the return code is positive it means abnormal exit if proc.returncode != 0: - raise Exception("Dragonfly did not terminate gracefully") + raise Exception( + f"Dragonfly did not terminate gracefully, exit code {proc.returncode}" + ) except subprocess.TimeoutExpired: # We need to send SIGUSR1 to DF such that it prints the stacktrace