summaryrefslogtreecommitdiffstats
path: root/src/common/assert.cc
diff options
context:
space:
mode:
authorMykola Golub <mgolub@suse.com>2018-10-21 09:34:30 +0200
committerMykola Golub <mgolub@suse.com>2018-10-21 09:44:41 +0200
commit626c93f7b63567171acc11afaff25c51d2685b1b (patch)
treec83555932603a99232a6a0b30796b809755b6195 /src/common/assert.cc
parentpybind/mgr: make 'ceph crash ls' output sorted list (diff)
downloadceph-626c93f7b63567171acc11afaff25c51d2685b1b.tar.xz
ceph-626c93f7b63567171acc11afaff25c51d2685b1b.zip
global: store assert msg in global and dump to crash meta
Signed-off-by: Mykola Golub <mgolub@suse.com>
Diffstat (limited to 'src/common/assert.cc')
-rw-r--r--src/common/assert.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/common/assert.cc b/src/common/assert.cc
index 2803e0b7305..f5b74263dba 100644
--- a/src/common/assert.cc
+++ b/src/common/assert.cc
@@ -48,13 +48,12 @@ namespace ceph {
ostringstream tss;
tss << ceph_clock_now();
- char buf[8096];
- snprintf(buf, sizeof(buf),
+ snprintf(g_assert_msg, sizeof(g_assert_msg),
"%s: In function '%s' thread %llx time %s\n"
"%s: %d: FAILED ceph_assert(%s)\n",
file, func, (unsigned long long)pthread_self(), tss.str().c_str(),
file, line, assertion);
- dout_emergency(buf);
+ dout_emergency(g_assert_msg);
// TODO: get rid of this memory allocation.
ostringstream oss;
@@ -62,7 +61,7 @@ namespace ceph {
dout_emergency(oss.str());
if (g_assert_context) {
- lderr(g_assert_context) << buf << std::endl;
+ lderr(g_assert_context) << g_assert_msg << std::endl;
*_dout << oss.str() << dendl;
// dump recent only if the abort signal handler won't do it for us
@@ -124,8 +123,7 @@ namespace ceph {
ceph_pthread_getname(pthread_self(), g_assert_thread_name,
sizeof(g_assert_thread_name));
- char buf[8096];
- BufAppender ba(buf, sizeof(buf));
+ BufAppender ba(g_assert_msg, sizeof(g_assert_msg));
BackTrace *bt = new BackTrace(1);
ba.printf("%s: In function '%s' thread %llx time %s\n"
"%s: %d: FAILED ceph_assert(%s)\n",
@@ -137,7 +135,7 @@ namespace ceph {
ba.vprintf(msg, args);
va_end(args);
ba.printf("\n");
- dout_emergency(buf);
+ dout_emergency(g_assert_msg);
// TODO: get rid of this memory allocation.
ostringstream oss;
@@ -145,7 +143,7 @@ namespace ceph {
dout_emergency(oss.str());
if (g_assert_context) {
- lderr(g_assert_context) << buf << std::endl;
+ lderr(g_assert_context) << g_assert_msg << std::endl;
*_dout << oss.str() << dendl;
// dump recent only if the abort signal handler won't do it for us