diff options
author | Mykola Golub <mgolub@suse.com> | 2018-10-21 09:34:30 +0200 |
---|---|---|
committer | Mykola Golub <mgolub@suse.com> | 2018-10-21 09:44:41 +0200 |
commit | 626c93f7b63567171acc11afaff25c51d2685b1b (patch) | |
tree | c83555932603a99232a6a0b30796b809755b6195 /src/common/assert.cc | |
parent | pybind/mgr: make 'ceph crash ls' output sorted list (diff) | |
download | ceph-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.cc | 14 |
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 |