Skip to content

Crash on DNS lookup #560

Closed
Closed

Description

@cacharle

I'm getting an inconsistent crash in some unit tests which spin up a websocket server/client.

Unexpected error 9 on netlink descriptor 7.

Thread 1393 "ws://127.0.0.1:" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff540e680 (LWP 34520)]
0x00007ffff64a774c in ?? () from /usr/lib/libc.so.6

(gdb) bt
#0  0x00007ffff64a774c in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff644ddc0 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff643557a in abort () from /usr/lib/libc.so.6
#3  0x00007ffff64365c9 in ?? () from /usr/lib/libc.so.6
#4  0x00007ffff649ac89 in __libc_fatal () from /usr/lib/libc.so.6
#5  0x00007ffff653d7c8 in __netlink_assert_response () from /usr/lib/libc.so.6
#6  0x00007ffff653cf47 in ?? () from /usr/lib/libc.so.6
#7  0x00007ffff655583a in getaddrinfo () from /usr/lib/libc.so.6
#8  0x0000555556fb4561 in ix::DNSLookup::getAddrInfo (this=0x7fffe80110d0, hostname="127.0.0.1", port=9999, errMsg="")
    at /home/charles/git/vcpkg/buildtrees/ixwebsocket/src/v11.4.5-fb1eb11bb0.clean/ixwebsocket/IXDNSLookup.cpp:65
#9  0x0000555556fb4aba in ix::DNSLookup::run (this=0x7fffe80110d0, self=std::weak_ptr<ix::DNSLookup> (use count 2, weak count 3) = {...}, hostname="127.0.0.1", port=9999)
    at /home/charles/git/vcpkg/buildtrees/ixwebsocket/src/v11.4.5-fb1eb11bb0.clean/ixwebsocket/IXDNSLookup.cpp:160
#10 0x0000555556fb722d in std::__invoke_impl<void, void (ix::DNSLookup::*)(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int), ix::DNSLookup*, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> (
    __f=@0x7fffe8012768: (void (ix::DNSLookup::*)(ix::DNSLookup * const, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)) 0x555556fb4a5a <ix::DNSLookup::run(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)>, __t=@0x7fffe8012760: 0x7fffe80110d0) at /usr/include/c++/15.1.1/bits/invoke.h:76
#11 0x0000555556fb7095 in std::__invoke<void (ix::DNSLookup::*)(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int), ix::DNSLookup*, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> (
    __fn=@0x7fffe8012768: (void (ix::DNSLookup::*)(ix::DNSLookup * const, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)) 0x555556fb4a5a <ix::DNSLookup::run(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)>) at /usr/include/c++/15.1.1/bits/invoke.h:98
#12 0x0000555556fb6f43 in std::thread::_Invoker<std::tuple<void (ix::DNSLookup::*)(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int), ix::DNSLookup*, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul> (this=0x7fffe8012728)
    at /usr/include/c++/15.1.1/bits/std_thread.h:303
#13 0x0000555556fb6e5a in std::thread::_Invoker<std::tuple<void (ix::DNSLookup::*)(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int), ix::DNSLookup*, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> >::operator() (this=0x7fffe8012728) at /usr/include/c++/15.1.1/bits/std_thread.h:310
#14 0x0000555556fb6b5a in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (ix::DNSLookup::*)(std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int), ix::DNSLookup*, std::weak_ptr<ix::DNSLookup>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > >::_M_run (this=0x7fffe8012720)
    at /usr/include/c++/15.1.1/bits/std_thread.h:255
#15 0x00007ffff66e51a4 in std::execute_native_thread_routine (__p=0x7fffe8012720) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#16 0x00007ffff64a57eb in ?? () from /usr/lib/libc.so.6
#17 0x00007ffff652918c in ?? () from /usr/lib/libc.so.6

It happens on the getaddrinfo call at

int getaddrinfo_result = getaddrinfo(hostname.c_str(), sport.c_str(), &hints, &res);

The unit tests worked fine for a long time, the issue only appeared when I shuffle them and run them over and over again.

I'm probably just not cleaning up properly at some point and I'll investigate that but I think the library shouldn't crash.

I'm using v11.4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions