]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
global/signal_handler: dump backtrace even from within logging code 12925/head
authorSage Weil <sage@redhat.com>
Tue, 10 Jan 2017 03:53:31 +0000 (21:53 -0600)
committerSage Weil <sage@redhat.com>
Fri, 13 Jan 2017 16:40:53 +0000 (11:40 -0500)
We can dump the backtrace regardless of where we hit the assertion.

Signed-off-by: Sage Weil <sage@redhat.com>
src/global/signal_handler.cc

index e8f21c1610a149d9f2c6f1f24cdee882b95009d3..66db79d2b2094e87d1a2b1d517b563642c6cff44 100644 (file)
@@ -111,19 +111,19 @@ static void handle_fatal_signal(int signum)
   dout_emergency(buf);
   pidfile_remove();
 
+  // TODO: don't use an ostringstream here. It could call malloc(), which we
+  // don't want inside a signal handler.
+  // Also fix the backtrace code not to allocate memory.
+  BackTrace bt(0);
+  ostringstream oss;
+  bt.print(oss);
+  dout_emergency(oss.str());
+
   // avoid recursion back into logging code if that is where
   // we got the SEGV.
   if (g_ceph_context &&
       g_ceph_context->_log &&
       !g_ceph_context->_log->is_inside_log_lock()) {
-    // TODO: don't use an ostringstream here. It could call malloc(), which we
-    // don't want inside a signal handler.
-    // Also fix the backtrace code not to allocate memory.
-    BackTrace bt(0);
-    ostringstream oss;
-    bt.print(oss);
-    dout_emergency(oss.str());
-
     // dump to log.  this uses the heap extensively, but we're better
     // off trying than not.
     derr << buf << std::endl;