This is an automated email from the ASF dual-hosted git repository.
alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push:
new c71f8abbb [test] avoid coredump in socket-test when failing
c71f8abbb is described below
commit c71f8abbbebb6e8c003090c0bb5866b443b8955f
Author: Alexey Serbin <[email protected]>
AuthorDate: Mon Apr 18 12:26:28 2022 -0700
[test] avoid coredump in socket-test when failing
I noticed the socket-test crashed when SocketTest.TestRecvReset failed
with the stack trace below. This patch updates the code to at least
avoid the crash in case of a failure.
src/kudu/util/net/socket-test.cc:144: Failure
Value of: s.message().ToString()
Expected: contains regular expression "recv error from 127.0.0.1:[0-9]+:
Resource temporarily unavailable"
Actual: "recv error from unknown peer: Transport endpoint is not
connected"
terminating
*** Aborted at 1650307680 (unix time) try "date -d @1650307680" if you
are using GNU date ***
PC: @ 0x7f37ddbe0fb7 gsignal
*** SIGABRT (@0x3e800005198) received by PID 20888 (TID 0x7f37e10253c0)
from PID 20888; stack trace: ***
@ 0x437b40 __tsan::CallUserSignalHandler()
@ 0x43a274 rtl_sigaction()
@ 0x7f37de1bd980 (unknown) at ??:0
@ 0x7f37ddbe0fb7 gsignal at ??:0
@ 0x7f37ddbe2921 abort at ??:0
@ 0x43bfd7 __interceptor_abort
@ 0x7f37de791a05 abort_message at ??:0
@ 0x7f37de7763be demangling_terminate_handler() at ??:0
@ 0x7f37de790b58 std::__terminate() at ??:0
@ 0x7f37de790ae8 std::terminate() at ??:0
@ 0x7f37dea76b81 std::__1::thread::~thread() at ??:0
@ 0x4dc097 kudu::SocketTest::DoTestServerDisconnects() at
src/kudu/util/net/socket-test.cc:147
@ 0x4db093 kudu::SocketTest_TestRecvReset_Test::TestBody()
at src/kudu/util/net/socket-test.cc:?
@ 0x7f37df11d500
testing::internal::HandleExceptionsInMethodIfSupported<>() at ??:0
@ 0x7f37df0f2452 testing::Test::Run() at ??:0
@ 0x7f37df0f39ea testing::TestInfo::Run() at ??:0
@ 0x7f37df0f4757 testing::TestSuite::Run() at ??:0
@ 0x7f37df108527 testing::internal::UnitTestImpl::RunAllTests()
at ??:0
@ 0x7f37df11e6e0
testing::internal::HandleExceptionsInMethodIfSupported<>() at ??:0
@ 0x7f37df107acd testing::UnitTest::Run() at ??:0
@ 0x7f37e11c2e1c RUN_ALL_TESTS() at ??:0
@ 0x7f37e11c1c6a main at ??:0
@ 0x7f37ddbc3bf7 __libc_start_main at ??:0
@ 0x4306ad (unknown) at ??:?
Change-Id: I5cf8f7b9acfac7b1935e6e6d9b3ac5016ee753d9
Reviewed-on: http://gerrit.cloudera.org:8080/18425
Reviewed-by: Andrew Wong <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
---
src/kudu/util/net/socket-test.cc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/kudu/util/net/socket-test.cc b/src/kudu/util/net/socket-test.cc
index 882a695d4..dacae8512 100644
--- a/src/kudu/util/net/socket-test.cc
+++ b/src/kudu/util/net/socket-test.cc
@@ -133,17 +133,17 @@ class SocketTest : public KuduTest {
CHECK_OK(listener_.Close());
}
});
+ SCOPED_CLEANUP({
+ t.join();
+ });
Socket client = ConnectToListeningServer();
int n;
std::unique_ptr<uint8_t[]> buf(new uint8_t[kEchoChunkSize]);
- Status s = client.Recv(buf.get(), kEchoChunkSize, &n);
+ const auto s = client.Recv(buf.get(), kEchoChunkSize, &n);
- ASSERT_TRUE(!s.ok());
ASSERT_TRUE(s.IsNetworkError()) << s.ToString();
ASSERT_STR_MATCHES(s.message().ToString(), message);
-
- t.join();
}
void DoUnixSocketTest(const string& path) {
@@ -166,6 +166,7 @@ class SocketTest : public KuduTest {
MonoTime::Now() + MonoDelta::FromSeconds(10)));
CHECK_OK(sock.Close());
});
+ auto cleanup = MakeScopedCleanup([&] { t.join(); });
Socket client = ConnectToListeningServer();
@@ -178,7 +179,9 @@ class SocketTest : public KuduTest {
char buf[kData.size()];
ASSERT_OK(client.BlockingRecv(reinterpret_cast<uint8_t*>(buf),
kData.size(), &n,
MonoTime::Now() +
MonoDelta::FromSeconds(5)));
+ cleanup.cancel();
t.join();
+
ASSERT_OK(client.Close());
ASSERT_EQ(n, kData.size());