add right_to_die info into CRASH ERROR
This commit is contained in:
12
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
vendored
12
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
vendored
@ -181,9 +181,17 @@ void coredump_cb(int sig, siginfo_t *si, void *context)
|
|||||||
if (UINT64_MAX != g_rlimit_core) {
|
if (UINT64_MAX != g_rlimit_core) {
|
||||||
safe_snprintf(rlimit_core, sizeof(rlimit_core), "%lu", g_rlimit_core);
|
safe_snprintf(rlimit_core, sizeof(rlimit_core), "%lu", g_rlimit_core);
|
||||||
}
|
}
|
||||||
|
char crash_info[128] = "CRASH ERROR!!!";
|
||||||
|
int64_t fatal_error_thread_id = get_fatal_error_thread_id();
|
||||||
|
if (-1 != fatal_error_thread_id) {
|
||||||
|
safe_snprintf(crash_info, sizeof(crash_info),
|
||||||
|
"Right to Die or Duty to Live's Thread Existed before CRASH ERROR!!!"
|
||||||
|
"ThreadId=%ld,", fatal_error_thread_id);
|
||||||
|
}
|
||||||
ssize_t print_len = safe_snprintf(print_buf, sizeof(print_buf),
|
ssize_t print_len = safe_snprintf(print_buf, sizeof(print_buf),
|
||||||
"CRASH ERROR!!! IP=%lx, RBP=%lx, sig=%d, sig_code=%d, sig_addr=%p, RLIMIT_CORE=%s, "COMMON_FMT", ",
|
"%s IP=%lx, RBP=%lx, sig=%d, sig_code=%d, sig_addr=%p, RLIMIT_CORE=%s, "COMMON_FMT", ",
|
||||||
ip, bp, sig, si->si_code, si->si_addr, rlimit_core, ts, GETTID(), tname, uval[0], uval[1], uval[2], uval[3],
|
crash_info, ip, bp, sig, si->si_code, si->si_addr, rlimit_core,
|
||||||
|
ts, GETTID(), tname, uval[0], uval[1], uval[2], uval[3],
|
||||||
(NULL == extra_info) ? NULL : to_cstring(*extra_info), bt);
|
(NULL == extra_info) ? NULL : to_cstring(*extra_info), bt);
|
||||||
const auto &si_guard = ObSqlInfoGuard::get_cur_guard();
|
const auto &si_guard = ObSqlInfoGuard::get_cur_guard();
|
||||||
char sql[] = "SQL=";
|
char sql[] = "SQL=";
|
||||||
|
@ -27,11 +27,22 @@ namespace oceanbase
|
|||||||
namespace common
|
namespace common
|
||||||
{
|
{
|
||||||
_RLOCAL(bool, in_try_stmt);
|
_RLOCAL(bool, in_try_stmt);
|
||||||
|
int64_t g_fatal_error_thread_id = -1;
|
||||||
|
|
||||||
|
int64_t get_fatal_error_thread_id()
|
||||||
|
{
|
||||||
|
return g_fatal_error_thread_id;
|
||||||
|
}
|
||||||
|
void set_fatal_error_thread_id(int64_t thread_id)
|
||||||
|
{
|
||||||
|
g_fatal_error_thread_id = thread_id;
|
||||||
|
}
|
||||||
|
|
||||||
// To die or to live, it's a problem.
|
// To die or to live, it's a problem.
|
||||||
void right_to_die_or_duty_to_live()
|
void right_to_die_or_duty_to_live()
|
||||||
{
|
{
|
||||||
const ObFatalErrExtraInfoGuard *extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
|
const ObFatalErrExtraInfoGuard *extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
|
||||||
|
set_fatal_error_thread_id(GETTID());
|
||||||
while (true) {
|
while (true) {
|
||||||
const char *info = (NULL == extra_info) ? NULL : to_cstring(*extra_info);
|
const char *info = (NULL == extra_info) ? NULL : to_cstring(*extra_info);
|
||||||
LOG_DBA_ERROR(OB_ERR_THREAD_PANIC, "msg", "Trying so hard to die", KCSTRING(info), KCSTRING(lbt()));
|
LOG_DBA_ERROR(OB_ERR_THREAD_PANIC, "msg", "Trying so hard to die", KCSTRING(info), KCSTRING(lbt()));
|
||||||
|
@ -21,6 +21,10 @@ namespace oceanbase
|
|||||||
namespace common
|
namespace common
|
||||||
{
|
{
|
||||||
extern void right_to_die_or_duty_to_live();
|
extern void right_to_die_or_duty_to_live();
|
||||||
|
int64_t get_fatal_error_thread_id();
|
||||||
|
void set_fatal_error_thread_id(int64_t thread_id);
|
||||||
|
|
||||||
|
|
||||||
RLOCAL_EXTERN(bool, in_try_stmt);
|
RLOCAL_EXTERN(bool, in_try_stmt);
|
||||||
|
|
||||||
struct OB_BASE_EXCEPTION : public std::exception
|
struct OB_BASE_EXCEPTION : public std::exception
|
||||||
|
Reference in New Issue
Block a user