При трассировке стека от backtrace не было обнаружено метода, вызвавшего сбой в многопоточной среде.

Я пытался точно определить, какой метод или, по крайней мере, какой класс вылетел из моего кода
сообщения, возвращаемые путем возврата после получения сигнала SIGSEGV. Это потому, что сбойный метод выполнялся в другом потоке, поэтому обратная трассировка не смогла этого сделать (см. Первую строку моего журнала — идентификатор процесса — 7fdae0268700, я добавил туда код для сбоя моего приложения)? Любые рекомендации по этому вопросу, пожалуйста?

    2013-03-07 17:43:42.863709502 [7fdae0268700] DEBUG data_service - I Crash You! Location
2013-03-07 17:43:42.863804548 [7fdae7d1c720] INFO  service_runner - Receive signal 11
2013-03-07 17:43:42.870357301 [7fdae7d1c720] DEBUG service_runner - [bt]: (0) ../Debug/MyAppService : my_app_service_lib::service_runner::handle_crash_stop(boost::system::error_code const&, int)+0x7e [0xcccf54]
2013-03-07 17:43:42.870369392 [7fdae7d1c720] DEBUG service_runner - [bt]: (1) ../Debug/MyAppService : boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>::operator()(my_app_service_lib::service_runner*, boost::system::error_code const&, int) const+0x74 [0xcd8278]
2013-03-07 17:43:42.870384611 [7fdae7d1c720] DEBUG service_runner - [bt]: (2) ../Debug/MyAppService : void boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> >::operator()<boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list2<boost::system::error_code const&, int const&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>&, boost::_bi::list2<boost::system::error_code const&, int const&>&, int)+0x7c [0xcd80c6]
2013-03-07 17:43:42.870395158 [7fdae7d1c720] DEBUG service_runner - [bt]: (3) ../Debug/MyAppService : void boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >::operator()<boost::system::error_code, int>(boost::system::error_code const&, int const&)+0x4c [0xcd7f0e]
2013-03-07 17:43:42.870405480 [7fdae7d1c720] DEBUG service_runner - [bt]: (4) ../Debug/MyAppService : boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>::operator()()+0x2b [0xcd7e15]
2013-03-07 17:43:42.870419010 [7fdae7d1c720] DEBUG service_runner - [bt]: (5) ../Debug/MyAppService : void boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int> >(boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>, ...)+0x62 [0xcd7d2e]
2013-03-07 17:43:42.870436180 [7fdae7d1c720] DEBUG service_runner - [bt]: (6) ../Debug/MyAppService : void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > > >(boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >, boost::system::error_code, int>&, boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > >&)+0x64 [0xcd7bea]
2013-03-07 17:43:42.870447863 [7fdae7d1c720] DEBUG service_runner - [bt]: (7) ../Debug/MyAppService : boost::asio::detail::signal_handler<boost::_bi::bind_t<void, boost::_mfi::mf2<void, my_app_service_lib::service_runner, boost::system::error_code const&, int>, boost::_bi::list3<boost::_bi::value<my_app_service_lib::service_runner*>, boost::arg<1>, boost::arg<2> > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)+0xb9 [0xcd78db]
2013-03-07 17:43:42.870454915 [7fdae7d1c720] DEBUG service_runner - [bt]: (8) ../Debug/MyAppService : boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long)+0x32 [0xcce3ba]
2013-03-07 17:43:42.870462704 [7fdae7d1c720] DEBUG service_runner - [bt]: (9) ../Debug/MyAppService : boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service::thread_info&, boost::system::error_code const&)+0x1a1 [0xcd09b3]
2013-03-07 17:43:42.870469226 [7fdae7d1c720] DEBUG service_runner - [bt]: (10) ../Debug/MyAppService : boost::asio::detail::task_io_service::run(boost::system::error_code&)+0x137 [0xcd050b]
2013-03-07 17:43:42.870474974 [7fdae7d1c720] DEBUG service_runner - [bt]: (11) ../Debug/MyAppService : boost::asio::io_service::run()+0x2f [0xcd0d31]
2013-03-07 17:43:42.870480654 [7fdae7d1c720] DEBUG service_runner - [bt]: (12) ../Debug/MyAppService : my_app_service_lib::service_runner::run()+0x97 [0xcccda9]
2013-03-07 17:43:42.870486438 [7fdae7d1c720] DEBUG service_runner - [bt]: (13) ../Debug/MyAppService : main+0x4cc [0xcc5838]
2013-03-07 17:43:42.870491274 [7fdae7d1c720] DEBUG service_runner - [bt]: (14) /lib64/libc.so.6 : __libc_start_main+0xfd [0x3f0f01ecdd]
2013-03-07 17:43:42.870495884 [7fdae7d1c720] DEBUG service_runner - [bt]: (15) ../Debug/MyAppService() [0xcc5289]

1

Решение

Если вы используете обработчик, вызываемый boost::asio::signal_set::async_wait звонить backtrace_symbols(3) это не сработает. signal_set класс использует signalfd в Linux другие платформы могут использовать трюк выбора канала-прерывания, я не знаю конкретно. Поэтому, когда ваш обработчик вызывается, он не будет из потока, вызвавшего SEGV.

Обычно не рекомендуется пытаться делать что-нибудь умное / милое при встрече с SEGV сигнал. Ты не можешь надежно продолжить исполнение. Я предлагаю не обращаться с SEGV сигнал и вместо этого настройте вашу систему на дамп ядра, когда процесс завершился ненормально, затем проанализируйте дамп ядра.

1

Другие решения

Других решений пока нет …