chore: call debug stacktrace on SIGUSR1 (#2012)

* add macro to install a signal handler that prints the contents of debug stacktrace on SIGUSR1
* add this on regTests
This commit is contained in:
Kostas Kyrimis 2023-10-20 10:50:55 +03:00 committed by GitHub
parent 64841efeed
commit 1d02e12ad1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 3 deletions

View file

@ -19,6 +19,7 @@ extern "C" {
#include <absl/strings/str_format.h>
#include <xxhash.h>
#include <csignal>
#include <filesystem>
#include "base/flags.h"
@ -647,6 +648,18 @@ Service::Service(ProactorPool* pp)
exit(1);
}
#ifdef PRINT_STACKTRACES_ON_SIGNAL
LOG(INFO) << "PRINT STACKTRACES REGISTERED";
pp_.GetNextProactor()->RegisterSignal({SIGUSR1}, [this](int signal) {
LOG(INFO) << "Received " << strsignal(signal);
util::fb2::Mutex m;
pp_.AwaitFiberOnAll([&m](unsigned index, util::ProactorBase* base) {
std::unique_lock lk(m);
util::fb2::detail::FiberInterface::PrintAllFiberStackTraces();
});
});
#endif
shard_set = new EngineShardSet(pp);
// We support less than 1024 threads and we support less than 1024 shards.