1717#include < sstream>
1818
1919#include " include/compat.h"
20+ #include " include/str_list.h"
2021#include " common/BackTrace.h"
2122#include " common/Clock.h" // for ceph_clock_now()
2223#include " common/debug.h"
@@ -70,6 +71,7 @@ namespace ceph {
7071 oss << ClibBackTrace (1 );
7172 dout_emergency (oss.str ());
7273
74+ bool should_abort = true ;
7375 if (g_assert_context) {
7476 lderr (g_assert_context) << g_assert_msg << std::endl;
7577 *_dout << oss.str () << dendl;
@@ -78,9 +80,22 @@ namespace ceph {
7880 if (!g_assert_context->_conf ->fatal_signal_handlers ) {
7981 g_assert_context->_log ->dump_recent ();
8082 }
81- }
8283
83- abort ();
84+ // bypass the abort?
85+ const auto supressions = get_str_list (
86+ g_assert_context->_conf .get_val <std::string>(" ceph_assert_supresssions" ));
87+ should_abort = std::none_of (
88+ std::begin (supressions), std::end (supressions),
89+ [file, line](const auto & supression) {
90+ return supression == fmt::format (" {}:{}" , file, line);
91+ });
92+ }
93+ if (should_abort) {
94+ abort ();
95+ } else {
96+ dout_emergency (" WARNING: ceph_assert() does NOT abort() due "
97+ " to ceph_assert_supresssions" );
98+ }
8499 }
85100
86101 [[gnu::cold]] void __ceph_assert_fail (const assert_data &ctx)
@@ -151,6 +166,7 @@ namespace ceph {
151166 oss << *bt;
152167 dout_emergency (oss.str ());
153168
169+ bool should_abort = true ;
154170 if (g_assert_context) {
155171 lderr (g_assert_context) << g_assert_msg << std::endl;
156172 *_dout << oss.str () << dendl;
@@ -159,9 +175,22 @@ namespace ceph {
159175 if (!g_assert_context->_conf ->fatal_signal_handlers ) {
160176 g_assert_context->_log ->dump_recent ();
161177 }
162- }
163178
164- abort ();
179+ // bypass the abort?
180+ const auto supressions = get_str_list (
181+ g_assert_context->_conf .get_val <std::string>(" ceph_assert_supresssions" ));
182+ should_abort = std::none_of (
183+ std::begin (supressions), std::end (supressions),
184+ [file, line](const auto & supression) {
185+ return supression == fmt::format (" {}:{}" , file, line);
186+ });
187+ }
188+ if (should_abort) {
189+ abort ();
190+ } else {
191+ dout_emergency (" WARNING: ceph_assertf() does NOT abort() due to"
192+ " to ceph_assert_supresssions" );
193+ }
165194 }
166195
167196 [[gnu::cold]] void __ceph_abort (const char *file, int line,
0 commit comments