]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/assert: get rid of duplicate log dump from assert handler
authorSage Weil <sage@redhat.com>
Fri, 15 Jun 2018 22:37:10 +0000 (17:37 -0500)
committerDan Mick <dan.mick@redhat.com>
Mon, 15 Oct 2018 23:45:41 +0000 (16:45 -0700)
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 <sage@redhat.com>
(cherry picked from commit 3a7b9e47bd89c24adb82e068020dada270bb08ee)

src/common/assert.cc
src/global/global_init.cc

index 0bc04a385a8b27ac246d387a258d3a1fbba13f04..4501c8b38a1c19a8e68413ac7d4e05066d96ad42 100644 (file)
@@ -51,16 +51,14 @@ namespace ceph {
     oss << BackTrace(1);
     dout_emergency(oss.str());
 
-    dout_emergency(" NOTE: a copy of the executable, or `objdump -rdS <executable>` "
-                  "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 <executable>` "
-            << "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 <executable>` "
-                  "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 <executable>` "
-            << "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();
index 8fd9247b0421a885be4034f9ef4abbfe60e0cd65..41ea214a38f90060066dc30181f0ce5da440bb38 100644 (file)
@@ -191,8 +191,10 @@ global_init(const std::map<std::string,std::string> *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<std::string,std::string> *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();