icinga2
icinga2 copied to clipboard
Subprocess terminates with SIGSEGV
Describe the bug
A subprocess of the main Icinga2 thread, which e.g performs config validation before reloading Icinga2 terminates most of the time with SIGSEGV and sometimes with SIGTRAP signals. You will observe such behaviors only when you start Icinga2 either in a notice or debug mode, which is strange. Though with the help of address sanitizer I was able to figure out why it doesn't crash in info mode. This line of code somehow causes the crash when icinga2 validates the configs interally. As we are doing log notice, it can' t cause a crash in info mode and config validation succeeds and Icinga2 is reloading normally.
https://github.com/Icinga/icinga2/blob/db321b9fcb659b19fbf2488da0050edd0fd92d53/lib/base/workqueue.cpp#L123-L124
To Reproduce
Start Icinga2 in notice or debug mode and post stage updates (not in the _api package), which will force Icinga2 to re-validate the configurations and reload and you will see this error. Icinga2 itself (the main process) does not crash and doesn’t also get reloaded, only the subprocess which performs config validation internally will terminate silently. Sometimes Icinga2 generates a crush dump files but without any content.
Additional context
I played around with address sanitizer and was able to generate some backtraces.
=================================================================
==81812==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600003c3a0 at pc 0x00010de0aefa bp 0x7ff7b2106c60 sp 0x7ff7b2106c58
READ of size 1 at 0x60600003c3a0 thread T0
#0 0x10de0aef9 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const string:1462
#1 0x10de0ac6d in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::size() const string:970
#2 0x10de1808e in std::__1::_MetaBase<__can_be_converted_to_string_view<char, std::__1::char_traits<char>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >::value>::_EnableIfImpl<int> std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare<std::__1::basic_string_view<char, std::__1::char_traits<char> > >(std::__1::basic_string_view<char, std::__1::char_traits<char> > const&) const string:3877
#3 0x10e297cca in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::compare(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const string:3895
#4 0x10e2927f8 in bool std::__1::operator<<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) string:4122
#5 0x10e2927e8 in icinga::String::operator<(icinga::String const&) const string.cpp:122
#6 0x10e167a68 in std::__1::less<icinga::String>::operator()(icinga::String const&, icinga::String const&) const __functional_base:54
#7 0x10e16901b in std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>::operator()(std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > const&, icinga::String const&) const map:518
#8 0x10e1698ef in std::__1::__tree_const_iterator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*, long> std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::__lower_bound<icinga::String>(icinga::String const&, std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*, std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>*) const __tree:2557
#9 0x10e1696dd in std::__1::__tree_const_iterator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*, long> std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::find<icinga::String>(icinga::String const&) const __tree:2477
#10 0x10e164501 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::find(icinga::String const&) const map:1382
#11 0x10e163163 in icinga::Namespace::GetAttribute(icinga::String const&) const namespace.cpp:82
#12 0x10e162e42 in icinga::Namespace::Get(icinga::String const&, icinga::Value*) const namespace.cpp:35
#13 0x10e1f27b6 in icinga::ScriptGlobal::Get(icinga::String const&, icinga::Value const*) scriptglobal.cpp:24
#14 0x10de2d381 in icinga::Application::DisplayInfoMessage(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool) application.cpp:565
#15 0x10de3009c in icinga::Application::ExceptionHandler() application.cpp:873
#16 0x7ff81e6d24d6 in std::__terminate(void (*)())+0x7 (libc++abi.dylib:x86_64+0xf4d6)
#17 0x7ff81e6d2487 in std::terminate()+0x37 (libc++abi.dylib:x86_64+0xf487)
#18 0x10e0f2ee8 in icinga::Log::~Log() logger.cpp:212
#19 0x10e391fe7 in icinga::WorkQueue::Join(bool) workqueue.cpp:123
#20 0x10e391c45 in icinga::WorkQueue::~WorkQueue() workqueue.cpp:34
#21 0x10e3921a8 in icinga::WorkQueue::~WorkQueue() workqueue.cpp:31
#22 0x10e54aefb in icinga::ApiListener::~ApiListener() apilistener.hpp:75
#23 0x10e5233b8 in icinga::ApiListener::~ApiListener() apilistener.hpp:75
#24 0x10e5233cd in icinga::ApiListener::~ApiListener() apilistener.hpp:75
#25 0x10e17ad50 in icinga::intrusive_ptr_release(icinga::Object*) object.cpp:261
#26 0x10de393db in boost::intrusive_ptr<icinga::ConfigObject>::~intrusive_ptr() intrusive_ptr.hpp:98
#27 0x10de32478 in boost::intrusive_ptr<icinga::ConfigObject>::~intrusive_ptr() intrusive_ptr.hpp:97
#28 0x10df0c6b1 in std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::ConfigObject> >::~pair() utility:297
#29 0x10df0c698 in std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::ConfigObject> >::~pair() utility:297
#30 0x10df0c648 in void std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, void*> > >::destroy<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::ConfigObject> >, void, void>(std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, void*> >&, std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::ConfigObject> >*) allocator_traits.h:317
#31 0x10df0c5c5 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, void*>*) __tree:1801
#32 0x10df0c558 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> > > >::~__tree() __tree:1789
#33 0x10df0c538 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::ConfigObject> > > >::~__tree() __tree:1786
#34 0x10df0c528 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::ConfigObject>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::ConfigObject> > > >::~map() map:1092
#35 0x10df09ff8 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::ConfigObject>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::ConfigObject> > > >::~map() map:1090
#36 0x10df09fbd in icinga::ConfigType::~ConfigType() configtype.cpp:10
#37 0x10de9e9d1 in icinga::TypeImpl<icinga::ConfigObject>::~TypeImpl() configobject-ti.cpp:91
#38 0x10e4f1bd8 in icinga::TypeImpl<icinga::ApiListener>::~TypeImpl() apilistener-ti.cpp:22
#39 0x10e4f1be8 in icinga::TypeImpl<icinga::ApiListener>::~TypeImpl() apilistener-ti.cpp:22
#40 0x10e4f1c0d in icinga::TypeImpl<icinga::ApiListener>::~TypeImpl() apilistener-ti.cpp:22
#41 0x10e17ad50 in icinga::intrusive_ptr_release(icinga::Object*) object.cpp:261
#42 0x10de0ffeb in boost::intrusive_ptr<icinga::Object>::~intrusive_ptr() intrusive_ptr.hpp:98
#43 0x10de0ffb8 in boost::intrusive_ptr<icinga::Object>::~intrusive_ptr() intrusive_ptr.hpp:97
#44 0x10de0ff9b in void boost::detail::variant::destroyer::internal_visit<boost::intrusive_ptr<icinga::Object> >(boost::intrusive_ptr<icinga::Object>&, int) const variant.hpp:386
#45 0x10de0ff80 in boost::detail::variant::destroyer::result_type boost::detail::variant::visitation_impl_invoke_impl<boost::detail::variant::destroyer, void*, boost::intrusive_ptr<icinga::Object> >(int, boost::detail::variant::destroyer&, void*, boost::intrusive_ptr<icinga::Object>*, mpl_::bool_<true>) visitation_impl.hpp:117
#46 0x10de0fde8 in boost::detail::variant::destroyer::result_type boost::detail::variant::visitation_impl_invoke<boost::detail::variant::destroyer, void*, boost::intrusive_ptr<icinga::Object>, boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::has_fallback_type_>(int, boost::detail::variant::destroyer&, void*, boost::intrusive_ptr<icinga::Object>*, boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::has_fallback_type_, int) visitation_impl.hpp:157
#47 0x10e3702cc in boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::destroy_content() variant.hpp:1365
#48 0x10e37053d in boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::~variant() variant.hpp:1372
#49 0x10e370568 in boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::~variant() variant.hpp:1371
#50 0x10de0fd78 in icinga::Value::~Value() value.hpp:36
#51 0x10de08728 in icinga::Value::~Value() value.hpp:36
#52 0x10e166b34 in icinga::EmbeddedNamespaceValue::~EmbeddedNamespaceValue() namespace.hpp:26
#53 0x10e166b58 in icinga::ConstEmbeddedNamespaceValue::~ConstEmbeddedNamespaceValue() namespace.hpp:37
#54 0x10e1661a8 in icinga::ConstEmbeddedNamespaceValue::~ConstEmbeddedNamespaceValue() namespace.hpp:37
#55 0x10e1661bd in icinga::ConstEmbeddedNamespaceValue::~ConstEmbeddedNamespaceValue() namespace.hpp:37
#56 0x10de1e460 in icinga::intrusive_ptr_release(icinga::SharedObject*) shared-object.hpp:67
#57 0x10e045299 in boost::intrusive_ptr<icinga::NamespaceValue>::~intrusive_ptr() intrusive_ptr.hpp:98
#58 0x10e0430d8 in boost::intrusive_ptr<icinga::NamespaceValue>::~intrusive_ptr() intrusive_ptr.hpp:97
#59 0x10e166aa1 in std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >::~pair() utility:297
#60 0x10e166a88 in std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >::~pair() utility:297
#61 0x10e166a38 in void std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> > >::destroy<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >, void, void>(std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> >&, std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >*) allocator_traits.h:317
#62 0x10e1669b5 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1801
#63 0x10e166985 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1798
#64 0x10e166985 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1798
#65 0x10e166985 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1798
#66 0x10e166948 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~__tree() __tree:1789
#67 0x10e166928 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~__tree() __tree:1786
#68 0x10e166918 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~map() map:1092
#69 0x10e166868 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~map() map:1090
#70 0x10e16682d in icinga::Namespace::~Namespace() namespace.hpp:67
#71 0x10e166128 in icinga::Namespace::~Namespace() namespace.hpp:67
#72 0x10e16613d in icinga::Namespace::~Namespace() namespace.hpp:67
#73 0x10e17ad50 in icinga::intrusive_ptr_release(icinga::Object*) object.cpp:261
#74 0x10de0ffeb in boost::intrusive_ptr<icinga::Object>::~intrusive_ptr() intrusive_ptr.hpp:98
#75 0x10de0ffb8 in boost::intrusive_ptr<icinga::Object>::~intrusive_ptr() intrusive_ptr.hpp:97
#76 0x10de0ff9b in void boost::detail::variant::destroyer::internal_visit<boost::intrusive_ptr<icinga::Object> >(boost::intrusive_ptr<icinga::Object>&, int) const variant.hpp:386
#77 0x10de0ff80 in boost::detail::variant::destroyer::result_type boost::detail::variant::visitation_impl_invoke_impl<boost::detail::variant::destroyer, void*, boost::intrusive_ptr<icinga::Object> >(int, boost::detail::variant::destroyer&, void*, boost::intrusive_ptr<icinga::Object>*, mpl_::bool_<true>) visitation_impl.hpp:117
#78 0x10de0fde8 in boost::detail::variant::destroyer::result_type boost::detail::variant::visitation_impl_invoke<boost::detail::variant::destroyer, void*, boost::intrusive_ptr<icinga::Object>, boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::has_fallback_type_>(int, boost::detail::variant::destroyer&, void*, boost::intrusive_ptr<icinga::Object>*, boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::has_fallback_type_, int) visitation_impl.hpp:157
#79 0x10e3702cc in boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::destroy_content() variant.hpp:1365
#80 0x10e37053d in boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::~variant() variant.hpp:1372
#81 0x10e370568 in boost::variant<boost::blank, double, bool, icinga::String, boost::intrusive_ptr<icinga::Object> >::~variant() variant.hpp:1371
#82 0x10de0fd78 in icinga::Value::~Value() value.hpp:36
#83 0x10de08728 in icinga::Value::~Value() value.hpp:36
#84 0x10e166b34 in icinga::EmbeddedNamespaceValue::~EmbeddedNamespaceValue() namespace.hpp:26
#85 0x10e166b58 in icinga::ConstEmbeddedNamespaceValue::~ConstEmbeddedNamespaceValue() namespace.hpp:37
#86 0x10e1661a8 in icinga::ConstEmbeddedNamespaceValue::~ConstEmbeddedNamespaceValue() namespace.hpp:37
#87 0x10e1661bd in icinga::ConstEmbeddedNamespaceValue::~ConstEmbeddedNamespaceValue() namespace.hpp:37
#88 0x10de1e460 in icinga::intrusive_ptr_release(icinga::SharedObject*) shared-object.hpp:67
#89 0x10e045299 in boost::intrusive_ptr<icinga::NamespaceValue>::~intrusive_ptr() intrusive_ptr.hpp:98
#90 0x10e0430d8 in boost::intrusive_ptr<icinga::NamespaceValue>::~intrusive_ptr() intrusive_ptr.hpp:97
#91 0x10e166aa1 in std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >::~pair() utility:297
#92 0x10e166a88 in std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >::~pair() utility:297
#93 0x10e166a38 in void std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> > >::destroy<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >, void, void>(std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> >&, std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> >*) allocator_traits.h:317
#94 0x10e1669b5 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1801
#95 0x10e1669a4 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1799
#96 0x10e1669a4 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1799
#97 0x10e166948 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~__tree() __tree:1789
#98 0x10e166928 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~__tree() __tree:1786
#99 0x10e166918 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~map() map:1092
#100 0x10e166868 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~map() map:1090
#101 0x10e16682d in icinga::Namespace::~Namespace() namespace.hpp:67
#102 0x10e166128 in icinga::Namespace::~Namespace() namespace.hpp:67
#103 0x10e16613d in icinga::Namespace::~Namespace() namespace.hpp:67
#104 0x10e17ad50 in icinga::intrusive_ptr_release(icinga::Object*) object.cpp:261
#105 0x10de5f36b in boost::intrusive_ptr<icinga::Namespace>::~intrusive_ptr() intrusive_ptr.hpp:98
#106 0x10de2e048 in boost::intrusive_ptr<icinga::Namespace>::~intrusive_ptr() intrusive_ptr.hpp:97
#107 0x7ff81e60fcdc in __cxa_finalize_ranges+0x198 (libsystem_c.dylib:x86_64+0x2ecdc)
#108 0x7ff81e60faf6 in exit+0x22 (libsystem_c.dylib:x86_64+0x2eaf6)
#109 0x10de299d4 in icinga::Application::Exit(int) application.cpp:116
#110 0x10ddfea89 in main icinga.cpp:948
#111 0x1229934fd in start+0x1cd (dyld:x86_64+0x54fd)
0x60600003c3a0 is located 32 bytes inside of 64-byte region [0x60600003c380,0x60600003c3c0)
freed by thread T0 here:
#0 0x118588d1d in wrap__ZdlPv+0x7d (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x50d1d)
#1 0x10e166728 in void std::__1::__libcpp_operator_delete<void*>(void*) new:245
#2 0x10e166718 in void std::__1::__do_deallocate_handle_size<>(void*, unsigned long) new:269
#3 0x10e166708 in std::__1::__libcpp_deallocate(void*, unsigned long, unsigned long) new:279
#4 0x10e166ad8 in std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> >::deallocate(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*, unsigned long) memory:879
#5 0x10e166a58 in std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> > >::deallocate(std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> >&, std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*, unsigned long) allocator_traits.h:280
#6 0x10e1669bd in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1802
#7 0x10e166985 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1798
#8 0x10e1669a4 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::destroy(std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*) __tree:1799
#9 0x10e166948 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~__tree() __tree:1789
#10 0x10e166928 in std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~__tree() __tree:1786
#11 0x10e166918 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~map() map:1092
#12 0x10e166868 in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::~map() map:1090
#13 0x10e16682d in icinga::Namespace::~Namespace() namespace.hpp:67
#14 0x10e166128 in icinga::Namespace::~Namespace() namespace.hpp:67
#15 0x10e16613d in icinga::Namespace::~Namespace() namespace.hpp:67
#16 0x10e17ad50 in icinga::intrusive_ptr_release(icinga::Object*) object.cpp:261
#17 0x10de5f36b in boost::intrusive_ptr<icinga::Namespace>::~intrusive_ptr() intrusive_ptr.hpp:98
#18 0x10de2e048 in boost::intrusive_ptr<icinga::Namespace>::~intrusive_ptr() intrusive_ptr.hpp:97
#19 0x7ff81e60fcdc in __cxa_finalize_ranges+0x198 (libsystem_c.dylib:x86_64+0x2ecdc)
#20 0x7ff81e60faf6 in exit+0x22 (libsystem_c.dylib:x86_64+0x2eaf6)
#21 0x10de299d4 in icinga::Application::Exit(int) application.cpp:116
#22 0x10ddfea89 in main icinga.cpp:948
#23 0x1229934fd in start+0x1cd (dyld:x86_64+0x54fd)
previously allocated by thread T0 here:
#0 0x1185888fd in wrap__Znwm+0x7d (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x508fd)
#1 0x10e167a58 in void* std::__1::__libcpp_operator_new<unsigned long>(unsigned long) new:235
#2 0x10e167a48 in std::__1::__libcpp_allocate(unsigned long, unsigned long) new:261
#3 0x10e16a6bd in std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> >::allocate(unsigned long) memory:870
#4 0x10e16a628 in std::__1::allocator_traits<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> > >::allocate(std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> >&, unsigned long) allocator_traits.h:260
#5 0x10e16a283 in std::__1::unique_ptr<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>, std::__1::__tree_node_destructor<std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*> > > > std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::__construct_node<std::__1::piecewise_construct_t const&, std::__1::tuple<icinga::String const&>, std::__1::tuple<> >(std::__1::piecewise_construct_t const&, std::__1::tuple<icinga::String const&>&&, std::__1::tuple<>&&) __tree:2133
#6 0x10e169e15 in std::__1::pair<std::__1::__tree_iterator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__tree_node<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, void*>*, long>, bool> std::__1::__tree<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::__map_value_compare<icinga::String, std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> >, std::__1::less<icinga::String>, true>, std::__1::allocator<std::__1::__value_type<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue> > > >::__emplace_unique_key_args<icinga::String, std::__1::piecewise_construct_t const&, std::__1::tuple<icinga::String const&>, std::__1::tuple<> >(icinga::String const&, std::__1::piecewise_construct_t const&, std::__1::tuple<icinga::String const&>&&, std::__1::tuple<>&&) __tree:2096
#7 0x10e16499c in std::__1::map<icinga::String, boost::intrusive_ptr<icinga::NamespaceValue>, std::__1::less<icinga::String>, std::__1::allocator<std::__1::pair<icinga::String const, boost::intrusive_ptr<icinga::NamespaceValue> > > >::operator[](icinga::String const&) map:1521
#8 0x10e1647cd in icinga::Namespace::SetAttribute(icinga::String const&, boost::intrusive_ptr<icinga::NamespaceValue> const&) namespace.cpp:94
#9 0x10e1653d1 in icinga::NamespaceBehavior::Register(boost::intrusive_ptr<icinga::Namespace> const&, icinga::String const&, icinga::Value const&, bool, icinga::DebugInfo const&) const namespace.cpp:165
#10 0x10e1636c2 in icinga::Namespace::SetFieldByName(icinga::String const&, icinga::Value const&, bool, icinga::DebugInfo const&) namespace.cpp:116
#11 0x10e1f2dbb in icinga::ScriptGlobal::Set(icinga::String const&, icinga::Value const&, bool) scriptglobal.cpp:62
#12 0x10f070ecf in icinga::IcingaApplication::StaticInitialize() icingaapplication.cpp:48
#13 0x10e08fd9e in decltype(std::__1::forward<void (*&)()>(fp)()) std::__1::__invoke<void (*&)()>(void (*&)()) type_traits:3694
#14 0x10e08fd68 in void std::__1::__invoke_void_return_wrapper<void, true>::__call<void (*&)()>(void (*&)()) __functional_base:348
#15 0x10e08fd50 in std::__1::__function::__alloc_func<void (*)(), std::__1::allocator<void (*)()>, void ()>::operator()() functional:1558
#16 0x10e08ebdc in std::__1::__function::__func<void (*)(), std::__1::allocator<void (*)()>, void ()>::operator()() functional:1732
#17 0x10e0ebbaf in std::__1::__function::__value_func<void ()>::operator()() const functional:1885
#18 0x10e0ebb58 in std::__1::function<void ()>::operator()() const functional:2560
#19 0x10e0eb758 in icinga::DeferredInitializer::operator()() loader.hpp:28
#20 0x10e0eb5e4 in icinga::Loader::ExecuteDeferredInitializers() loader.cpp:24
#21 0x10de29ee4 in icinga::Application::InitializeBase() application.cpp:141
#22 0x10ddfea6c in main icinga.cpp:920
#23 0x1229934fd in start+0x1cd (dyld:x86_64+0x54fd)
SUMMARY: AddressSanitizer: heap-use-after-free string:1462 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const
Shadow bytes around the buggy address:
0x1c0c00007820: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
0x1c0c00007830: fa fa fa fa fd fd fd fd fd fd fd fd fa fa fa fa
0x1c0c00007840: fd fd fd fd fd fd fd fd fa fa fa fa fd fd fd fd
0x1c0c00007850: fd fd fd fd fa fa fa fa fd fd fd fd fd fd fd fd
0x1c0c00007860: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
=>0x1c0c00007870: fd fd fd fd[fd]fd fd fd fa fa fa fa fd fd fd fd
0x1c0c00007880: fd fd fd fd fa fa fa fa 00 00 00 00 00 00 00 00
0x1c0c00007890: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
0x1c0c000078a0: fd fd fd fd fd fd fd fd fa fa fa fa 00 00 00 00
0x1c0c000078b0: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00
0x1c0c000078c0: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==81812==ABORTING
<Terminated by signal 6 (Abort trap: 6).>)
Ah, and it' s obvious now that this isn't a SIGSEGV but it' s due to the use of the above mentioned tool, otherwise the process is always terminated with SIGSEGV.
What's your CMAKE_BUILD_TYPE?
What's your CMAKE_BUILD_TYPE?
Always Debug.
Ahh, and you can also reproduce this just with the following command icinga2 daemon -C -x notice
Does it also occur with Release/RelWith...?
Note
You have to run icinga2 api setup before.