From: Sage Weil Date: Fri, 15 Jun 2018 22:37:10 +0000 (-0500) Subject: common/assert: get rid of duplicate log dump from assert handler X-Git-Tag: v14.0.1~1042^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3a7b9e47bd89c24adb82e068020dada270bb08ee;p=ceph.git common/assert: get rid of duplicate log dump from assert handler When we abort() we get the log dump. Only do it from the assert handler if the fatal_signal_handlers are disabled for some reason. Signed-off-by: Sage Weil --- diff --git a/src/common/assert.cc b/src/common/assert.cc index 0bc04a385a8b..4501c8b38a1c 100644 --- a/src/common/assert.cc +++ b/src/common/assert.cc @@ -51,16 +51,14 @@ namespace ceph { oss << BackTrace(1); dout_emergency(oss.str()); - dout_emergency(" NOTE: a copy of the executable, or `objdump -rdS ` " - "is needed to interpret this.\n"); - if (g_assert_context) { lderr(g_assert_context) << buf << std::endl; - *_dout << oss.str(); - *_dout << " NOTE: a copy of the executable, or `objdump -rdS ` " - << "is needed to interpret this.\n" << dendl; + *_dout << oss.str() << dendl; - g_assert_context->_log->dump_recent(); + // dump recent only if the abort signal handler won't do it for us + if (!g_assert_context->_conf->fatal_signal_handlers) { + g_assert_context->_log->dump_recent(); + } } abort(); @@ -126,16 +124,14 @@ namespace ceph { oss << *bt; dout_emergency(oss.str()); - dout_emergency(" NOTE: a copy of the executable, or `objdump -rdS ` " - "is needed to interpret this.\n"); - if (g_assert_context) { lderr(g_assert_context) << buf << std::endl; - *_dout << oss.str(); - *_dout << " NOTE: a copy of the executable, or `objdump -rdS ` " - << "is needed to interpret this.\n" << dendl; + *_dout << oss.str() << dendl; - g_assert_context->_log->dump_recent(); + // dump recent only if the abort signal handler won't do it for us + if (!g_assert_context->_conf->fatal_signal_handlers) { + g_assert_context->_log->dump_recent(); + } } abort(); diff --git a/src/global/global_init.cc b/src/global/global_init.cc index a990d5d3e7d6..98ad9300e084 100644 --- a/src/global/global_init.cc +++ b/src/global/global_init.cc @@ -191,8 +191,10 @@ global_init(const std::map *defaults, int siglist[] = { SIGPIPE, 0 }; block_signals(siglist, NULL); - if (g_conf->fatal_signal_handlers) + if (g_conf->fatal_signal_handlers) { install_standard_sighandlers(); + } + register_assert_context(g_ceph_context); if (g_conf->log_flush_on_exit) g_ceph_context->_log->set_flush_on_exit(); @@ -315,8 +317,6 @@ global_init(const std::map *defaults, } } - register_assert_context(g_ceph_context); - // call all observers now. this has the side-effect of configuring // and opening the log file immediately. g_conf->call_all_observers();