Skip to content

Commit

Permalink
Merge pull request #44129 from ClickHouse/better-signal-messages
Browse files Browse the repository at this point in the history
Better descriptions of signals
  • Loading branch information
alexey-milovidov committed Dec 12, 2022
2 parents 9a48cf0 + fddfd35 commit e5f8a4e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Daemon/BaseDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,29 @@ class SignalListener : public Poco::Runnable
DB::CurrentThread::attachInternalTextLogsQueue(logs_queue, DB::LogsLevel::trace);
}

std::string signal_description = "Unknown signal";

/// Some of these are not really signals, but our own indications on failure reason.
if (sig == StdTerminate)
signal_description = "std::terminate";
else if (sig == SanitizerTrap)
signal_description = "sanitizer trap";
else if (sig >= 0)
signal_description = strsignal(sig); // NOLINT(concurrency-mt-unsafe) // it is not thread-safe but ok in this context

LOG_FATAL(log, "########################################");

if (query_id.empty())
{
LOG_FATAL(log, "(version {}{}, build id: {}) (from thread {}) (no query) Received signal {} ({})",
VERSION_STRING, VERSION_OFFICIAL, daemon.build_id,
thread_num, strsignal(sig), sig); // NOLINT(concurrency-mt-unsafe) // it is not thread-safe but ok in this context
thread_num, signal_description, sig);
}
else
{
LOG_FATAL(log, "(version {}{}, build id: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})",
VERSION_STRING, VERSION_OFFICIAL, daemon.build_id,
thread_num, query_id, query, strsignal(sig), sig); // NOLINT(concurrency-mt-unsafe) // it is not thread-safe but ok in this context)
thread_num, query_id, query, signal_description, sig);
}

String error_message;
Expand Down

0 comments on commit e5f8a4e

Please sign in to comment.