mgorny created this revision. mgorny added reviewers: k8stone, labath, krytarowski. mgorny added a project: LLDB.
Fix the tests not to use '127.0.0.1' and 'localhost' interchangeably. More specifically, since tests bind specifically to 127.0.0.1, connect to that address as well; using 'localhost' can resolve to IPv6 address which can cause issues -- for example, if the matching port happens to be used by some other process, the tests hang forever waiting for the client to connect. While technically the case of randomly selected IPv4 port being taken on IPv6 loopback is not very likely, NetBSD happens to be suffering from some weird kernel issue where connection to that port succeeds nevertheless. Until we can really figure out what goes wrong there, this saves us from the tests hanging randomly. Repository: rLLDB LLDB https://reviews.llvm.org/D58131 Files: lldb/unittests/Host/SocketTest.cpp lldb/unittests/tools/lldb-server/tests/TestClient.cpp Index: lldb/unittests/tools/lldb-server/tests/TestClient.cpp =================================================================== --- lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -80,7 +80,7 @@ return status.ToError(); args.AppendArgument( - ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str()); + ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str()); for (StringRef arg : ServerArgs) args.AppendArgument(arg); Index: lldb/unittests/Host/SocketTest.cpp =================================================================== --- lldb/unittests/Host/SocketTest.cpp +++ lldb/unittests/Host/SocketTest.cpp @@ -179,7 +179,7 @@ [=](const TCPSocket &s) { char connect_remote_address[64]; snprintf(connect_remote_address, sizeof(connect_remote_address), - "localhost:%u", s.GetLocalPortNumber()); + "127.0.0.1:%u", s.GetLocalPortNumber()); return std::string(connect_remote_address); }, &socket_a_up, &socket_b_up); @@ -193,7 +193,7 @@ [=](const TCPSocket &s) { char connect_remote_address[64]; snprintf(connect_remote_address, sizeof(connect_remote_address), - "localhost:%u", s.GetLocalPortNumber()); + "127.0.0.1:%u", s.GetLocalPortNumber()); return std::string(connect_remote_address); }, &socket_a_up, &socket_b_up);
Index: lldb/unittests/tools/lldb-server/tests/TestClient.cpp =================================================================== --- lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -80,7 +80,7 @@ return status.ToError(); args.AppendArgument( - ("localhost:" + Twine(listen_socket.GetLocalPortNumber())).str()); + ("127.0.0.1:" + Twine(listen_socket.GetLocalPortNumber())).str()); for (StringRef arg : ServerArgs) args.AppendArgument(arg); Index: lldb/unittests/Host/SocketTest.cpp =================================================================== --- lldb/unittests/Host/SocketTest.cpp +++ lldb/unittests/Host/SocketTest.cpp @@ -179,7 +179,7 @@ [=](const TCPSocket &s) { char connect_remote_address[64]; snprintf(connect_remote_address, sizeof(connect_remote_address), - "localhost:%u", s.GetLocalPortNumber()); + "127.0.0.1:%u", s.GetLocalPortNumber()); return std::string(connect_remote_address); }, &socket_a_up, &socket_b_up); @@ -193,7 +193,7 @@ [=](const TCPSocket &s) { char connect_remote_address[64]; snprintf(connect_remote_address, sizeof(connect_remote_address), - "localhost:%u", s.GetLocalPortNumber()); + "127.0.0.1:%u", s.GetLocalPortNumber()); return std::string(connect_remote_address); }, &socket_a_up, &socket_b_up);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits