Jens Geyer created THRIFT-6215:
----------------------------------
Summary: C++: TServerIntegrationTest's stress test ends the whole
test binary when a client cannot connect
Key: THRIFT-6215
URL: https://issues.apache.org/jira/browse/THRIFT-6215
Project: Thrift
Issue Type: Bug
Components: C++ - Library, Test Suite
Reporter: Jens Geyer
h2. What happens
When the stressor threads in {{constructors/test_threaded_stress}} cannot
connect, the test binary does not report a failed check. It dies, and every
test case after it goes unreported:
{noformat}
Thrift: ... TSocket::open() connect() <Host: localhost Port: 37595>: Connection
refused
terminate called recursively
unknown location(0): fatal error: in "constructors/test_threaded_stress":
signal: SIGABRT (application abort requested)
lib/cpp/test/TServerIntegrationTest.cpp(373): last checkpoint:
"test_threaded_stress" test entry
{noformat}
Built from master in the {{thrift:jammy}} container, three runs ended once with
SIGABRT and twice with SIGSEGV; an earlier run in the same environment reported
{{*** stack smashing detected ***}}.
h2. Why
{{TServerIntegrationTestFixture::stressor()}}
({{TServerIntegrationTest.cpp:307}}) runs on a {{boost::thread}} and calls
{{pSocket->open()}} with nothing around it to catch a {{TTransportException}}.
An exception that leaves a thread function goes to {{std::terminate}}; when
several stressor threads fail together, the next one arrives while the first is
still terminating.
The connection failure itself is THRIFT-6191: server and client resolve
{{localhost}} with different {{getaddrinfo}} flags. With that change applied,
the same test binary passes three runs out of three. So this only shows when
something else is already wrong, and then it hides what that is.
h2. Suggested fix
Catch the exception in the thread body and hand it to the main thread to check,
so a connection failure fails the test case instead of ending the process.
_Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens Geyer._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)