This commit is contained in:
Alexey Milovidov 2019-07-02 03:19:56 +03:00
parent da04c2f1ce
commit 5c721ea711

View File

@ -154,12 +154,12 @@ static void faultSignalHandler(int sig, siginfo_t * info, void * context)
DB::WriteBufferFromFileDescriptor out(signal_pipe.write_fd, buf_size, buf); DB::WriteBufferFromFileDescriptor out(signal_pipe.write_fd, buf_size, buf);
const ucontext_t signal_context = *reinterpret_cast<ucontext_t *>(context); const ucontext_t signal_context = *reinterpret_cast<ucontext_t *>(context);
const StackTrace stackTrace(signal_context); const StackTrace stack_trace(signal_context);
DB::writeBinary(sig, out); DB::writeBinary(sig, out);
DB::writePODBinary(*info, out); DB::writePODBinary(*info, out);
DB::writePODBinary(signal_context, out); DB::writePODBinary(signal_context, out);
DB::writePODBinary(stackTrace, out); DB::writePODBinary(stack_trace, out);
DB::writeBinary(getThreadNumber(), out); DB::writeBinary(getThreadNumber(), out);
out.next(); out.next();
@ -232,15 +232,15 @@ public:
{ {
siginfo_t info; siginfo_t info;
ucontext_t context; ucontext_t context;
StackTrace stackTrace(NoCapture{}); StackTrace stack_trace(NoCapture{});
ThreadNumber thread_num; ThreadNumber thread_num;
DB::readPODBinary(info, in); DB::readPODBinary(info, in);
DB::readPODBinary(context, in); DB::readPODBinary(context, in);
DB::readPODBinary(stackTrace, in); DB::readPODBinary(stack_trace, in);
DB::readBinary(thread_num, in); DB::readBinary(thread_num, in);
onFault(sig, info, context, stackTrace, thread_num); onFault(sig, info, context, stack_trace, thread_num);
} }
} }
} }
@ -255,14 +255,14 @@ private:
LOG_ERROR(log, "(version " << VERSION_STRING << VERSION_OFFICIAL << ") (from thread " << thread_num << ") " << message); LOG_ERROR(log, "(version " << VERSION_STRING << VERSION_OFFICIAL << ") (from thread " << thread_num << ") " << message);
} }
void onFault(int sig, siginfo_t & info, ucontext_t & context, const StackTrace & stackTrace, ThreadNumber thread_num) const void onFault(int sig, siginfo_t & info, ucontext_t & context, const StackTrace & stack_trace, ThreadNumber thread_num) const
{ {
LOG_ERROR(log, "########################################"); LOG_ERROR(log, "########################################");
LOG_ERROR(log, "(version " << VERSION_STRING << VERSION_OFFICIAL << ") (from thread " << thread_num << ") " LOG_ERROR(log, "(version " << VERSION_STRING << VERSION_OFFICIAL << ") (from thread " << thread_num << ") "
<< "Received signal " << strsignal(sig) << " (" << sig << ")" << "."); << "Received signal " << strsignal(sig) << " (" << sig << ")" << ".");
LOG_ERROR(log, signalToErrorMessage(sig, info, context)); LOG_ERROR(log, signalToErrorMessage(sig, info, context));
LOG_ERROR(log, stackTrace.toString()); LOG_ERROR(log, stack_trace.toString());
} }
}; };