]> 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)
committerSage Weil <sage@redhat.com>
Tue, 19 Jun 2018 18:36:52 +0000 (13:36 -0500)
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>
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 a990d5d3e7d6a776435f4b9961cf645d61fe9134..98ad9300e08415b0706efbca9601982503b28e9b 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();