>

지난 한 달 동안이 문제를 해결하려고했지만 알아낼 수 없었습니다. 주 스레드 인이 gdb 로그가 있습니다.

부스트 1.53을 사용하기 전에 부스트 epoll_wait에서 경쟁 조건이 될 수 있다고 생각하고 부스트 1.58로 업데이트했지만 문제를 해결할 수 없었습니다.

   Thread 1 (Thread 0x7ffff7fe4740 (LWP 21665)):
#0  0x00007ffff7b14a13 in epoll_wait ()
    at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x0000000000538cd7 in boost::asio::detail::epoll_reactor::run(bool, boost::asio::detail::op_queue<boost::asio::detail::task_io_service_operation>&) [clone .constprop.204] (this=0x4, block=<optimized out>, ops=...)
    at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:392
        timeout = <optimized out>
        events = {{events = 1, data = {ptr = 0xb0b3c0, fd = 11580352, 
            u32 = 11580352, u64 = 11580352}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 4623520, 
            data = {ptr = 0xaa7bd800000000, fd = 0, u32 = 0, 
            u64 = 47986913683963904}}, {events = 0, data = {ptr = 0x8c81e0, 
            fd = 9208288, u32 = 9208288, u64 = 9208288}}, {events = 0, 
            data = {ptr = 0x56ec2b00000000, fd = 0, u32 = 0, 
            u64 = 24466517424865280}}, {events = 0, data = {
            ptr = 0x7fffffffd820, fd = -10208, u32 = 4294957088, 
            u64 = 140737488345120}}, {events = 5, data = {
            ptr = 0x736f6c6300000000, fd = 0, u32 = 0, 
            u64 = 8317986209234157568}}, {events = 101, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 11585136, data = {
            ptr = 0x2700000000, fd = 0, u32 = 0, u64 = 167503724544}}, {
            events = 0, data = {ptr = 0x27, fd = 39, u32 = 39, u64 = 39}}, {
            events = 0, data = {ptr = 0xdfaf1000000000, fd = 0, u32 = 0, 
            u64 = 62961403060813824}}, {events = 0, data = {ptr = 0x20, 
            fd = 32, u32 = 32, u64 = 32}}, {events = 0, data = {
            ptr = 0x63d42000000000, fd = 0, u32 = 0, 
            u64 = 28099256598396928}}, {events = 0, data = {ptr = 0x31, 
            fd = 49, u32 = 49, u64 = 49}}, {events = 0, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 4294957792, data = {
            ptr = 0xaa1b2800007fff, fd = 32767, u32 = 32767, 
            u64 = 47880604653486079}}, {events = 0, data = {ptr = 0xaa1b20, 
            fd = 11148064, u32 = 11148064, u64 = 11148064}}, {
            events = 11148096, data = {ptr = 0xb0c61000000000, fd = 0, 
            u32 = 0, u64 = 49757367922851840}}, {events = 0, data = {
            ptr = 0x4f46bc <Protocol::disconnect() const+76>, fd = 5195452, 
            u32 = 5195452, u64 = 5195452}}, {events = 4222451713, data = {
            ptr = 0xffffdae000000000, fd = 0, u32 = 0, 
            u64 = 18446703254340370432}}, {events = 2, data = {
            ptr = 0x7fffffffdae0, fd = -9504, u32 = 4294957792, 
            u64 = 140737488345824}}, {events = 11148080, data = {
            ptr = 0xaa7bd800000000, fd = 0, u32 = 0, 
            u64 = 47986913683963904}}, {events = 0, data = {
            ptr = 0x5342b8 <ProtocolLogin::onRecvFirstMessage(NetworkMessage&)+808>, fd = 5456568, u32 = 5456568, u64 = 5456568}}, {events = 4294957808, 
            data = {ptr = 0xffffdae000007fff, fd = 32767, u32 = 32767, 
            u64 = 18446703254340403199}}, {events = 32767, data = {
            ptr = 0x7fffffffdaf0, fd = -9488, u32 = 4294957808, 
            u64 = 140737488345840}}, {events = 0, data = {ptr = 0xb00000000, 
            fd = 0, u32 = 0, u64 = 47244640256}}, {events = 0, data = {
            ptr = 0xa1, fd = 161, u32 = 161, u64 = 161}}, {
            events = 4158462776, data = {ptr = 0xffffd97000007fff, fd = 32767, 
            u32 = 32767, u64 = 18446701673792438271}}, {events = 32767, 
            data = {ptr = 0x7ffff7dd1b70 <main_arena+80>, fd = -136504464, 
            u32 = 4158462832, u64 = 140737351850864}}, {events = 9873, 
            data = {ptr = 0xffffd96fffff8000, fd = -32768, u32 = 4294934528, 
            u64 = 18446701673792372736}}, {events = 32767, data = {
            ptr = 0x7fffffffd98f, fd = -9841, u32 = 4294957455, 
            u64 = 140737488345487}}, {events = 96, data = {
            ptr = 0xa100000000, fd = 0, u32 = 0, u64 = 691489734656}}, {
            events = 0, data = {ptr = 0x7fffffffd9d0, fd = -9776, 
            u32 = 4294957520, u64 = 140737488345552}}, {events = 6314788, 
            data = {ptr = 0x5b00000000, fd = 0, u32 = 0, u64 = 390842023936}}, 
        {events = 16777326, data = {ptr = 0x1300000000, fd = 0, u32 = 0, 
            u64 = 81604378624}}, {events = 9777, data = {
            ptr = 0xffffd9cfffff8000, fd = -32768, u32 = 4294934528, 
            u64 = 18446702086109233152}}, {events = 32767, data = {
            ptr = 0x2, fd = 2, u32 = 2, u64 = 2}}, {events = 4155593625, 
            data = {ptr = 0x7fff, fd = 32767, u32 = 32767, u64 = 32767}}, {
            events = 0, data = {
            ptr = 0x605bc5 <boost::asio::detail::reactive_socket_recv_op_base<boost::asio::mutable_buffers_1>::do_perform(boost::asio::detail::reactor_op*)+389>, fd = 6314949, u32 = 6314949, u64 = 6314949}}, {events = 91, data = {
            ptr = 0x100006e, fd = 16777326, u32 = 16777326, 
            u64 = 16777326}}, {events = 19, data = {ptr = 0x60, fd = 96, 
            u32 = 96, u64 = 96}}, {events = 161, data = {
            ptr = 0xffffda4000000000, fd = 0, u32 = 0, 
            u64 = 18446702567145603072}}, {events = 32767, data = {
            ptr = 0x18, fd = 24, u32 = 24, u64 = 24}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0xffff8000000025c1, fd = 9665, u32 = 9665, 
            u64 = 18446603336221205953}}, {events = 4294957631, data = {
            ptr = 0x200007fff, fd = 32767, u32 = 32767, u64 = 8589967359}}, {
            events = 0, data = {ptr = 0x7ffff7b15399 <recvmsg+57>, 
            fd = -139373671, u32 = 4155593625, u64 = 140737348981657}}, {
            events = 0, data = {ptr = 0x605b2400000000, fd = 0, u32 = 0, 
            u64 = 27121807941173248}}, {events = 0, data = {
            ptr = 0x100006e0000005b, fd = 91, u32 = 91, 
            u64 = 72058066484330587}}, {events = 0, data = {
            ptr = 0x8ede7500000013, fd = 19, u32 = 19, 
            u64 = 40214040785453075}}, {events = 0, data = {ptr = 0x2, 
            fd = 2, u32 = 2, u64 = 2}}, {events = 2, data = {
            ptr = 0x8f3f6800000000, fd = 0, u32 = 0, 
            u64 = 40320637578772480}}, {events = 0, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0xffffda3000000000, fd = 0, u32 = 0, 
            u64 = 18446702498426126336}}, {events = 32767, data = {
            ptr = 0x1, fd = 1, u32 = 1, u64 = 1}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 9363024, 
            data = {ptr = 0xc4a82a3000000000, fd = 0, u32 = 0, 
            u64 = 14170622613168062464}}, {events = 32767, data = {
            ptr = 0xb0b9e0, fd = 11581920, u32 = 11581920, u64 = 11581920}}, 
        {events = 9387880, data = {ptr = 0xb0b3e800000000, fd = 0, u32 = 0, 
            u64 = 49737404914860032}}, {events = 0, data = {ptr = 0x13, 
            fd = 19, u32 = 19, u64 = 19}}, {events = 82, data = {
            ptr = 0x8c84f000000000, fd = 0, u32 = 0, 
            u64 = 39552663066509312}}, {events = 0, data = {
            ptr = 0x61a9c5 <boost::asio::async_read<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&)> (std::shared_ptr<Connection>, std::_Placeholder<1>)> >(boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&, boost::asio::mutable_buffers_1 const&, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&)> (std::shared_ptr<Connection>, std::_Placeholder<1>)>&&) [clone .constprop.610]+901>, fd = 6400453, u32 = 6400453, u64 = 6400453}}, {
            events = 365290, data = {ptr = 0x1300000000, fd = 0, u32 = 0, 
            u64 = 81604378624}}, {events = 0, data = {ptr = 0x0, fd = 0, 
            u32 = 0, u64 = 0}}, {events = 5702176, data = {
            ptr = 0xffffdc5000000000, fd = 0, u32 = 0, 
            u64 = 18446704834888335360}}, {events = 32767, data = {
            ptr = 0x61ec35 <boost::date_time::microsec_clock<boost::posix_time::ptime>::create_time(tm* (*)(long const*, tm*)) [clone .constprop.632]+53>, 
            fd = 6417461, u32 = 6417461, u64 = 6417461}}, {
            events = 4294957856, data = {ptr = 0xb0b9e000007fff, fd = 32767, 
            u32 = 32767, u64 = 49743967624921087}}, {events = 0, data = {
            ptr = 0xb0b9e0, fd = 11581920, u32 = 11581920, u64 = 11581920}}, 
        {events = 6397484, data = {ptr = 0x8f3f6800000000, fd = 0, u32 = 0, 
            u64 = 40320637578772480}}, {events = 0, data = {ptr = 0x8ede75, 
            fd = 9363061, u32 = 9363061, u64 = 9363061}}, {events = 2, 
            data = {ptr = 0x100000000, fd = 0, u32 = 0, u64 = 4294967296}}, {
            events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {
            events = 5702176, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {
            events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {
            events = 0, data = {ptr = 0x300000000, fd = 0, u32 = 0, 
            u64 = 12884901888}}, {events = 261, data = {ptr = 0x0, fd = 0, 
            u32 = 0, u64 = 0}}, {events = 9363040, data = {
            ptr = 0x8ede5000000000, fd = 0, u32 = 0, 
            u64 = 40213881871663104}}, {events = 0, data = {
            ptr = 0x468ca0 <[email protected]>, fd = 4623520, 
            u32 = 4623520, u64 = 4623520}}, {events = 9209824, data = {
            ptr = 0xffffdbe000000000, fd = 0, u32 = 0, 
            u64 = 18446704353851998208}}, {events = 32767, data = {
            ptr = 0x8f3f08, fd = 9387784, u32 = 9387784, u64 = 9387784}}, {
            events = 5700037, data = {ptr = 0x100000000, fd = 0, u32 = 0, 
            u64 = 4294967296}}, {events = 0, data = {ptr = 0xa8db00, 
            fd = 11066112, u32 = 11066112, u64 = 11066112}}, {
            events = 9363061, data = {ptr = 0x200000000, fd = 0, u32 = 0, 
            u64 = 8589934592}}, {events = 0, data = {ptr = 0xa8db00, 
            fd = 11066112, u32 = 11066112, u64 = 11066112}}, {
            events = 6396619, data = {ptr = 0x57022000000000, fd = 0, u32 = 0, 
            u64 = 24490659436036096}}, {events = 0, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0x7fffffffdc50, fd = -9136, u32 = 4294958160, 
            u64 = 140737488346192}}, {events = 9363040, data = {
            ptr = 0x8f3f0800000000, fd = 0, u32 = 0, 
            u64 = 40320225261912064}}, {events = 0, data = {ptr = 0x1, 
            fd = 1, u32 = 1, u64 = 1}}, {events = 6, data = {
            ptr = 0xffffdc5000000000, fd = 0, u32 = 0, 
            u64 = 18446704834888335360}}, {events = 32767, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 5702335, 
            data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, 
            data = {ptr = 0x8c81e0, fd = 9208288, u32 = 9208288, 
            u64 = 9208288}}, {events = 4294958176, data = {
            ptr = 0x700007fff, fd = 32767, u32 = 32767, u64 = 30064803839}}, 
        {events = 0, data = {ptr = 0xa544f61727541, fd = 1634891073, 
            u32 = 1634891073, u64 = 2907449681147201}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0x7fffffffdd60, fd = -8864, u32 = 4294958432, 
            u64 = 140737488346464}}, {events = 9208240, data = {
            ptr = 0x100000000, fd = 0, u32 = 0, u64 = 4294967296}}, {
            events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {
            events = 9208288, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {
            events = 0, data = {
            ptr = 0x6080d0 <boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, std::_Bind<std::_Mem_fn<void (Connection::*)(boost::system::error_code const&)> (std::shared_ptr<Connection>, std::_Placeholder<1>)> > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long)+352>, fd = 6324432, 
            u32 = 6324432, u64 = 6324432}}, {events = 11581168, data = {
            ptr = 0xb0b6e000000000, fd = 0, u32 = 0, 
            u64 = 49740669090004992}}, {events = 0, data = {
            ptr = 0xb0a2e08000001f, fd = -2147483617, u32 = 2147483679, 
            u64 = 49718681004933151}}, {events = 4155593625, data = {
            ptr = 0xffffdd6000007fff, fd = 32767, u32 = 32767, 
            u64 = 18446706003119472639}}, {events = 32767, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 19, data = {
            ptr = 0x8f3f68, fd = 9387880, u32 = 9387880, u64 = 9387880}}, {
            events = 9363061, data = {ptr = 0x200000000, fd = 0, u32 = 0, 
            u64 = 8589934592}}, {events = 0, data = {ptr = 0x0, fd = 0, 
            u32 = 0, u64 = 0}}, {events = 2, data = {ptr = 0x57022000000000, 
            fd = 0, u32 = 0, u64 = 24490659436036096}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 9363040, 
            data = {ptr = 0x8ede5000000000, fd = 0, u32 = 0, 
            u64 = 40213881871663104}}, {events = 0, data = {ptr = 0x0, 
            fd = 0, u32 = 0, u64 = 0}}, {events = 4146303200, data = {
            ptr = 0x60afc100007fff, fd = 32767, u32 = 32767, 
            u64 = 27214841227804671}}, {events = 0, data = {
            ptr = 0x7fffcb192880, fd = -887543680, u32 = 3407423616, 
            u64 = 140736600811648}}, {events = 0, data = {
            ptr = 0x8f3f6800000000, fd = 0, u32 = 0, 
            u64 = 40320637578772480}}, {events = 0, data = {
            ptr = 0x7fffffffddb0, fd = -8784, u32 = 4294958512, 
            u64 = 140737488346544}}, {events = 9208240, data = {
            ptr = 0x60879e00000000, fd = 0, u32 = 0, 
            u64 = 27170710438805504}}, {events = 0, data = {ptr = 0x8ede60, 
            fd = 9363040, u32 = 9363040, u64 = 9363040}}, {events = 9363024, 
            data = {ptr = 0xffffddb000000000, fd = 0, u32 = 0, 
            u64 = 18446706346716823552}}, {events = 32767, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0x0, fd = 0, u32 = 0, u64 = 0}}, {events = 0, data = {
            ptr = 0x60afb0 <Connection::handleTimeout(std::weak_ptr<Connection>, boost::system::error_code const&)>, fd = 6336432, u32 = 6336432, 
            u64 = 6336432}}, {events = 9363040, data = {
            ptr = 0x8ede5000000000, fd = 0, u32 = 0, 
            u64 = 40213881871663104}}, {events = 0, data = {ptr = 0x7d, 
            fd = 125, u32 = 125, u64 = 125}}}
        num_events = <optimized out>
        check_timers = <optimized out>
#2  0x0000000000551743 in do_run_one (ec=..., this_thread=..., lock=..., 
    this=<optimized out>)
    at /usr/include/boost/asio/detail/impl/task_io_service.ipp:356
No locals.
#3  run (ec=..., this=<optimized out>)
    at /usr/include/boost/asio/detail/impl/task_io_service.ipp:149
        this_thread = {private_op_queue = {front_ = 0x0, back_ = 0x0}, 
        private_outstanding_work = 0}
        ctx = {key_ = 0x8c81b0, value_ = 0x7fffffffde70, next_ = 0x0}
        lock = {mutex_ = @0x8c81e0, locked_ = true}
#4  _ZN5boost4asio10io_service3runEv.isra.200 ()
    at /usr/include/boost/asio/impl/io_service.ipp:59
        ec = {m_val = 0, m_cat = 0x7ffff72390e0}
#5  ServiceManager::run() (this=<optimized out>)
    at /home/server/sources/src/server.cpp:46
No locals.
#6  0x000000000046c3c4 in main (argc=1, argv=0x7fffffffe138)
    at /home/server/sources/src/otserv.cpp:94
        serviceManager = {acceptors = std::unordered_map with 2 elements, 
        io_service = {service_registry_ = 0x8c8160, impl_ = @0x8c81b0}, 
        signals = {set = {<No data fields>}}, 
        death_timer = {<No data fields>}, running = true}
        __func__ = "main"
(gdb)

이 문제를 이전에보고했으며 경험을 공유 할 수있는 사람이 있습니까?이 문제는 하루에 한 번만 프로덕션 환경에서 발생합니다.

  • 답변 # 1

    this=0x4

    C ++의 UB 인 어딘가 (아마도 코드에서) 널 포인터를 참조하는 것처럼 보입니다.

    이 문제를 디버깅하는 한 가지 방법은 -fsanitize=undefined 를 사용하여 다시 작성하는 것입니다.  선택권. 최근 gcc 및 clang에서 사용할 수 있습니다.

    또는 -fsanitize=null 만으로도 재 구축 , 설명서를 참조하십시오 :

    와이즈 비즈 와이즈 비즈

  • 이전 명령형 언어에서 "필요한"재귀 사용
  • 다음 Netsuite Newbie : Netsuite에 대한 관심 선택