mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge 06b81efbdc
into da2176d696
This commit is contained in:
commit
ced7136f97
@ -2,6 +2,7 @@
|
|||||||
#include <Common/config_version.h>
|
#include <Common/config_version.h>
|
||||||
#include <Common/getHashOfLoadedBinary.h>
|
#include <Common/getHashOfLoadedBinary.h>
|
||||||
#include <Common/CurrentThread.h>
|
#include <Common/CurrentThread.h>
|
||||||
|
#include <Common/SymbolIndex.h>
|
||||||
#include <Daemon/BaseDaemon.h>
|
#include <Daemon/BaseDaemon.h>
|
||||||
#include <Daemon/SentryWriter.h>
|
#include <Daemon/SentryWriter.h>
|
||||||
#include <base/sleep.h>
|
#include <base/sleep.h>
|
||||||
@ -15,6 +16,7 @@
|
|||||||
#include <Core/Settings.h>
|
#include <Core/Settings.h>
|
||||||
#include <Poco/Environment.h>
|
#include <Poco/Environment.h>
|
||||||
|
|
||||||
|
|
||||||
#pragma clang diagnostic ignored "-Wreserved-identifier"
|
#pragma clang diagnostic ignored "-Wreserved-identifier"
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
@ -250,6 +252,16 @@ void blockSignals(const std::vector<int> & signals)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SignalListener::SignalListener(BaseDaemon * daemon_, LoggerPtr log_)
|
||||||
|
: daemon(daemon_), log(log_)
|
||||||
|
{
|
||||||
|
#if defined(__ELF__) && !defined(OS_FREEBSD)
|
||||||
|
build_id = SymbolIndex::instance().getBuildIDHex();
|
||||||
|
#else
|
||||||
|
build_id = "<unknown>";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SignalListener::run()
|
void SignalListener::run()
|
||||||
{
|
{
|
||||||
static_assert(PIPE_BUF >= 512);
|
static_assert(PIPE_BUF >= 512);
|
||||||
@ -336,7 +348,7 @@ void SignalListener::onTerminate(std::string_view message, UInt32 thread_num) co
|
|||||||
size_t pos = message.find('\n');
|
size_t pos = message.find('\n');
|
||||||
|
|
||||||
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}",
|
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}",
|
||||||
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH, thread_num, message.substr(0, pos));
|
VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH, thread_num, message.substr(0, pos));
|
||||||
|
|
||||||
/// Print trace from std::terminate exception line-by-line to make it easy for grep.
|
/// Print trace from std::terminate exception line-by-line to make it easy for grep.
|
||||||
while (pos != std::string_view::npos)
|
while (pos != std::string_view::npos)
|
||||||
@ -370,7 +382,7 @@ try
|
|||||||
|
|
||||||
LOG_FATAL(log, "########## Short fault info ############");
|
LOG_FATAL(log, "########## Short fault info ############");
|
||||||
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}, architecture: {}) (from thread {}) Received signal {}",
|
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}, architecture: {}) (from thread {}) Received signal {}",
|
||||||
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH, Poco::Environment::osArchitecture(),
|
VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH, Poco::Environment::osArchitecture(),
|
||||||
thread_num, sig);
|
thread_num, sig);
|
||||||
|
|
||||||
std::string signal_description = "Unknown signal";
|
std::string signal_description = "Unknown signal";
|
||||||
@ -436,13 +448,13 @@ try
|
|||||||
if (query_id.empty())
|
if (query_id.empty())
|
||||||
{
|
{
|
||||||
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})",
|
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})",
|
||||||
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
|
VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH,
|
||||||
thread_num, signal_description, sig);
|
thread_num, signal_description, sig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})",
|
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})",
|
||||||
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
|
VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH,
|
||||||
thread_num, query_id, query, signal_description, sig);
|
thread_num, query_id, query, signal_description, sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,16 +66,13 @@ public:
|
|||||||
static constexpr int StopThread = -2;
|
static constexpr int StopThread = -2;
|
||||||
static constexpr int SanitizerTrap = -3;
|
static constexpr int SanitizerTrap = -3;
|
||||||
|
|
||||||
explicit SignalListener(BaseDaemon * daemon_, LoggerPtr log_)
|
explicit SignalListener(BaseDaemon * daemon_, LoggerPtr log_);
|
||||||
: daemon(daemon_), log(log_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BaseDaemon * daemon;
|
BaseDaemon * daemon;
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
|
String build_id;
|
||||||
|
|
||||||
void onTerminate(std::string_view message, UInt32 thread_num) const;
|
void onTerminate(std::string_view message, UInt32 thread_num) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user