mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
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:
parent
64841efeed
commit
1d02e12ad1
4 changed files with 29 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue