mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
chore: log exit code of failing dragonfly in tests (#4166)
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
a694bf46b8
commit
b8c2dd888a
2 changed files with 7 additions and 7 deletions
|
@ -165,12 +165,12 @@ template <typename... Args> unique_ptr<Listener> MakeListener(Args&&... args) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) {
|
void RunEngine(ProactorPool* pool, AcceptServer* acceptor) {
|
||||||
uint64_t maxmemory = GetMaxMemoryFlag();
|
uint64_t maxmemory = GetMaxMemoryFlag();
|
||||||
if (maxmemory > 0 && maxmemory < pool->size() * 256_MB) {
|
if (maxmemory > 0 && maxmemory < pool->size() * 256_MB) {
|
||||||
LOG(ERROR) << "There are " << pool->size() << " threads, so "
|
LOG(ERROR) << "There are " << pool->size() << " threads, so "
|
||||||
<< HumanReadableNumBytes(pool->size() * 256_MB) << " are required. Exiting...";
|
<< HumanReadableNumBytes(pool->size() * 256_MB) << " are required. Exiting...";
|
||||||
return false;
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Service service(pool);
|
Service service(pool);
|
||||||
|
@ -310,8 +310,6 @@ bool RunEngine(ProactorPool* pool, AcceptServer* acceptor) {
|
||||||
|
|
||||||
version_monitor.Shutdown();
|
version_monitor.Shutdown();
|
||||||
service.Shutdown();
|
service.Shutdown();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreatePidFile(const string& path) {
|
bool CreatePidFile(const string& path) {
|
||||||
|
@ -791,7 +789,7 @@ Usage: dragonfly [FLAGS]
|
||||||
AcceptServer acceptor(pool.get(), &fb2::std_malloc_resource, true);
|
AcceptServer acceptor(pool.get(), &fb2::std_malloc_resource, true);
|
||||||
acceptor.set_back_log(absl::GetFlag(FLAGS_tcp_backlog));
|
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();
|
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.
|
// This is a workaround for a bug in mi_malloc that may cause a crash on exit.
|
||||||
mi_collect(true);
|
mi_collect(true);
|
||||||
|
|
||||||
return res;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,9 @@ class DflyInstance:
|
||||||
# if the return code is negative it means termination by signal
|
# if the return code is negative it means termination by signal
|
||||||
# if the return code is positive it means abnormal exit
|
# if the return code is positive it means abnormal exit
|
||||||
if proc.returncode != 0:
|
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:
|
except subprocess.TimeoutExpired:
|
||||||
# We need to send SIGUSR1 to DF such that it prints the stacktrace
|
# We need to send SIGUSR1 to DF such that it prints the stacktrace
|
||||||
|
|
Loading…
Reference in a new issue