Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky TCPSocketServer unit test #141

Closed
konserw opened this issue Mar 30, 2017 · 5 comments
Closed

Flaky TCPSocketServer unit test #141

konserw opened this issue Mar 30, 2017 · 5 comments

Comments

@konserw
Copy link
Contributor

konserw commented Mar 30, 2017

There is some kind of problem with TCPSocketServerTest unit test. All 4 fails:

The following tests FAILED:
	 21 - TCPSocketServerTest.exitsOnFirstConnectionClosed (OTHER_FAULT)
	 22 - TCPSocketServerTest.moreThanOneClientCanConnect (OTHER_FAULT)
	 23 - TCPSocketServerTest.receiveAndSendsSingleLineMassages (OTHER_FAULT)
	 24 - UnixSocketServerTest.fullLifecycle (OTHER_FAULT)

when I'm building cucumber with c++11 (and 14) enabled via CMake:

set_property(TARGET cucumber-cpp-nomain PROPERTY CXX_STANDARD 11)
set_property(TARGET cucumber-cpp PROPERTY CXX_STANDARD 11)

Those test failed before for me as outlined in #119 and then fixed itself after merging #120 for whatever reason.
Please help me investigate this issue.

EDIT:
full fail text:

21/91 Test #21: TCPSocketServerTest.exitsOnFirstConnectionClosed .................................***Exception: Other  0.07 sec
Running main() from gmock_main.cc
Note: Google Test filter = TCPSocketServerTest.exitsOnFirstConnectionClosed
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TCPSocketServerTest
[ RUN      ] TCPSocketServerTest.exitsOnFirstConnectionClosed
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  accept: Already open

      Start 22: TCPSocketServerTest.moreThanOneClientCanConnect
22/91 Test #22: TCPSocketServerTest.moreThanOneClientCanConnect ..................................***Exception: Other  0.08 sec
Running main() from gmock_main.cc
Note: Google Test filter = TCPSocketServerTest.moreThanOneClientCanConnect
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TCPSocketServerTest
[ RUN      ] TCPSocketServerTest.moreThanOneClientCanConnect
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  accept: Already open

      Start 23: TCPSocketServerTest.receiveAndSendsSingleLineMassages
23/91 Test #23: TCPSocketServerTest.receiveAndSendsSingleLineMassages ............................***Exception: Other  0.07 sec
Running main() from gmock_main.cc
Note: Google Test filter = TCPSocketServerTest.receiveAndSendsSingleLineMassages
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TCPSocketServerTest
[ RUN      ] TCPSocketServerTest.receiveAndSendsSingleLineMassages
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  accept: Already open

      Start 24: UnixSocketServerTest.fullLifecycle
24/91 Test #24: UnixSocketServerTest.fullLifecycle ...............................................***Exception: Other  0.12 sec
Running main() from gmock_main.cc
Note: Google Test filter = UnixSocketServerTest.fullLifecycle
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from UnixSocketServerTest
[ RUN      ] UnixSocketServerTest.fullLifecycle
/home/konserw/git/cucumber-cpp/tests/integration/WireServerTest.cpp:179: Failure
Value of: client
Expected: eventually receives "Y"
  Actual: 1528-byte object <D0-6F 53-00 00-00 00-00 00-00 00-00 00-00 00-00 F8-6F 53-00 00-00 00-00 78-73 53-00 00-00 00-00 98-7E 7C-74 FF-7F 00-00 A0-7E 7C-74 FF-7F 00-00 A0-7E 7C-74 FF-7F 00-00 98-80 7C-74 FF-7F 00-00 ... 40-83 7C-74 FF-7F 00-00 40-06 09-BA 7C-7F 00-00 00-00 00-00 00-00 00-00 00-00 60-01 00-00 00-00 28-7E 7C-74 FF-7F 00-00 60-00 09-BA 7C-7F 00-00 F0-FF 08-BA 7C-7F 00-00 00-00 09-BA 7C-7F 00-00>
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  accept: Already open
@konserw
Copy link
Contributor Author

konserw commented Mar 30, 2017

Those errors can be seen on Travis OSX as it has Qt 5.8 when building my #142 branch:
https://travis-ci.org/cucumber/cucumber-cpp/builds/216727887
For some reason those tests are disabled for Win32.

@muggenhor
Copy link
Contributor

I think only the Unix one should be disabled on Windows. The TCP ones were disabled when enabling MinGW support IIRC, not sure why though.

@paoloambrosio
Copy link
Member

paoloambrosio commented Apr 1, 2017

AFAIK running WireServerTest was disabled almost 4 years ago because they were crashing (not failing) on Windows and couldn't find out what was wrong with them. Feel free to re-enable them if you can verify that now they work.

@muggenhor
Copy link
Contributor

With the exact same config (compiling only the cucumber-cpp and cucumber-cpp-nomain targets as C++11) I get similar problems.

Keep in mind though that unless we very carefully craft our code to produce the same class layout for both C++ versions we definitely have a big ODR violation. Probably it's still an ODR violation even if we try our best to ensure everything's the same. Making a C++98 library usable in C++11 code is doable, but the reverse I'm not so sure of.

This problem goes away when I compile everything as C++11 or everything as C++98.

FYI my debug results:
When using Clang's UndefinedBehaviorSanitizer and AddressSanitizer (-fsanitize=address,undefined) I'm seeing:

$ build/tests/WireServerTest
Running main() from gmock_main.cc
[==========] Running 4 tests from 2 test cases.                                                                                                                                                                     [----------] Global test environment set-up.
[----------] 3 tests from TCPSocketServerTest
[ RUN      ] TCPSocketServerTest.exitsOnFirstConnectionClosed
/usr/include/boost/asio/basic_io_object.hpp:209:12: runtime error: reference binding to misaligned address 0x000000000002 for type 'boost::asio::stream_socket_service<boost::asio::ip::tcp>', which requires 8 byte
 alignment
0x000000000002: note: pointer points here                                                                                                                                                                           <memory cannot be printed>
    #0 0x755e22 in boost::asio::basic_io_object<boost::asio::stream_socket_service<boost::asio::ip::tcp>, true>::get_service() /usr/include/boost/asio/basic_io_object.hpp:209:5                                        #1 0x75989b in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::assign(boost::asio::ip::tcp const&, int const&, boost::system::error_code&) /usr/include/boost/asio/basic_socket.hpp:331:12
    #2 0x758c0b in boost::system::error_code boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::accept<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >(boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::implementation_type&, boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>*, boost::system::error_code&) /usr/include/boost/asio/detail/reactive_socket_service.hpp:389:12
    #3 0x757ef8 in _ZN5boost4asio23socket_acceptor_serviceINS0_2ip3tcpEE6acceptIS3_NS0_21stream_socket_serviceIS3_EEEENS_6system10error_codeERNS0_6detail23reactive_socket_serviceIS3_E19implementation_typeERNS0_12basic_socketIT_T0_EEPNS2_14basic_endpointIS3_EERS9_PNSt9enable_ifIXsr14is_convertibleIS3_SG_EE5valueEvE4typeE /usr/include/boost/asio/socket_acceptor_service.hpp:266:12
    #4 0x7552c7 in _ZN5boost4asio21basic_socket_acceptorINS0_2ip3tcpENS0_23socket_acceptor_serviceIS3_EEE6acceptIS3_NS0_21stream_socket_serviceIS3_EEEEvRNS0_12basic_socketIT_T0_EEPNSt9enable_ifIXsr14is_convertibleIS3_SB_EE5valueEvE4typeE /usr/include/boost/asio/basic_socket_acceptor.hpp:930:5
    #5 0x74634b in void cucumber::internal::SocketServer::doAcceptOnce<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >&) /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:31:5
    #6 0x742e82 in cucumber::internal::TCPSocketServer::acceptOnce() /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:57:5
    #7 0x6a5872 in boost::_mfi::mf0<void, cucumber::internal::SocketServer>::operator()(cucumber::internal::SocketServer*) const /usr/include/boost/bind/mem_fn_template.hpp:49:29
    #8 0x6a557b in void boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> >::operator()<boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, cucumber::internal::SocketServer>&, boost::_bi::list0&, int) /usr/include/boost/bind/bind.hpp:259:9
    #9 0x6a527d in boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > >::operator()() /usr/include/boost/bind/bind_template.hpp:20:27
    #10 0x69cf96 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > > >::run() /usr/include/boost/thread/detail/thread.hpp:116:17
    #11 0x7f4be3831115  (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.61.0+0x12115)
    #12 0x7f4be23be423 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7423)
    #13 0x7f4be1ade9be in clone (/lib/x86_64-linux-gnu/libc.so.6+0xe89be)

SUMMARY: AddressSanitizer: undefined-behavior /usr/include/boost/asio/basic_io_object.hpp:209:12 in
/usr/include/boost/asio/basic_socket.hpp:331:12: runtime error: member call on misaligned address 0x000000000002 for type 'boost::asio::stream_socket_service<boost::asio::ip::tcp>', which requires 8 byte alignment
0x000000000002: note: pointer points here
<memory cannot be printed>
    #0 0x7598e7 in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::assign(boost::asio::ip::tcp const&, int const&, boost::system::error_code&) /usr/include/boost/asio/basic_socket.hpp:331:12
    #1 0x758c0b in boost::system::error_code boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::accept<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >(boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::implementation_type&, boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>*, boost::system::error_code&) /usr/include/boost/asio/detail/reactive_socket_service.hpp:389:12
    #2 0x757ef8 in _ZN5boost4asio23socket_acceptor_serviceINS0_2ip3tcpEE6acceptIS3_NS0_21stream_socket_serviceIS3_EEEENS_6system10error_codeERNS0_6detail23reactive_socket_serviceIS3_E19implementation_typeERNS0_12basic_socketIT_T0_EEPNS2_14basic_endpointIS3_EERS9_PNSt9enable_ifIXsr14is_convertibleIS3_SG_EE5valueEvE4typeE /usr/include/boost/asio/socket_acceptor_service.hpp:266:12
    #3 0x7552c7 in _ZN5boost4asio21basic_socket_acceptorINS0_2ip3tcpENS0_23socket_acceptor_serviceIS3_EEE6acceptIS3_NS0_21stream_socket_serviceIS3_EEEEvRNS0_12basic_socketIT_T0_EEPNSt9enable_ifIXsr14is_convertibleIS3_SB_EE5valueEvE4typeE /usr/include/boost/asio/basic_socket_acceptor.hpp:930:5
    #4 0x74634b in void cucumber::internal::SocketServer::doAcceptOnce<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >&) /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:31:5
    #5 0x742e82 in cucumber::internal::TCPSocketServer::acceptOnce() /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:57:5
    #6 0x6a5872 in boost::_mfi::mf0<void, cucumber::internal::SocketServer>::operator()(cucumber::internal::SocketServer*) const /usr/include/boost/bind/mem_fn_template.hpp:49:29
    #7 0x6a557b in void boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> >::operator()<boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, cucumber::internal::SocketServer>&, boost::_bi::list0&, int) /usr/include/boost/bind/bind.hpp:259:9
    #8 0x6a527d in boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > >::operator()() /usr/include/boost/bind/bind_template.hpp:20:27
    #9 0x69cf96 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > > >::run() /usr/include/boost/thread/detail/thread.hpp:116:17
    #10 0x7f4be3831115  (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.61.0+0x12115)
    #11 0x7f4be23be423 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7423)
    #12 0x7f4be1ade9be in clone (/lib/x86_64-linux-gnu/libc.so.6+0xe89be)

SUMMARY: AddressSanitizer: undefined-behavior /usr/include/boost/asio/basic_socket.hpp:331:12 in
ASAN:DEADLYSIGNAL
=================================================================
==24457==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000002 (pc 0x0000007598ec bp 0x7f4bdd0fde30 sp 0x7f4bdd0fdca0 T1)
    #0 0x7598eb in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::assign(boost::asio::ip::tcp const&, int const&, boost::system::error_code&) /usr/include/boost/asio/basic_socket.hpp:331:12
    #1 0x758c0b in boost::system::error_code boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::accept<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > >(boost::asio::detail::reactive_socket_service<boost::asio::ip::tcp>::implementation_type&, boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>*, boost::system::error_code&) /usr/include/boost/asio/detail/reactive_socket_service.hpp:389:12
    #2 0x757ef8 in _ZN5boost4asio23socket_acceptor_serviceINS0_2ip3tcpEE6acceptIS3_NS0_21stream_socket_serviceIS3_EEEENS_6system10error_codeERNS0_6detail23reactive_socket_serviceIS3_E19implementation_typeERNS0_12basic_socketIT_T0_EEPNS2_14basic_endpointIS3_EERS9_PNSt9enable_ifIXsr14is_convertibleIS3_SG_EE5valueEvE4typeE /usr/include/boost/asio/socket_acceptor_service.hpp:266:12
    #3 0x7552c7 in _ZN5boost4asio21basic_socket_acceptorINS0_2ip3tcpENS0_23socket_acceptor_serviceIS3_EEE6acceptIS3_NS0_21stream_socket_serviceIS3_EEEEvRNS0_12basic_socketIT_T0_EEPNSt9enable_ifIXsr14is_convertibleIS3_SB_EE5valueEvE4typeE /usr/include/boost/asio/basic_socket_acceptor.hpp:930:5
    #4 0x74634b in void cucumber::internal::SocketServer::doAcceptOnce<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >(boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >&) /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:31:5
    #5 0x742e82 in cucumber::internal::TCPSocketServer::acceptOnce() /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:57:5
    #6 0x6a5872 in boost::_mfi::mf0<void, cucumber::internal::SocketServer>::operator()(cucumber::internal::SocketServer*) const /usr/include/boost/bind/mem_fn_template.hpp:49:29
    #7 0x6a557b in void boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> >::operator()<boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, cucumber::internal::SocketServer>&, boost::_bi::list0&, int) /usr/include/boost/bind/bind.hpp:259:9
    #8 0x6a527d in boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > >::operator()() /usr/include/boost/bind/bind_template.hpp:20:27
    #9 0x69cf96 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > > >::run() /usr/include/boost/thread/detail/thread.hpp:116:17
    #10 0x7f4be3831115  (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.61.0+0x12115)
    #11 0x7f4be23be423 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7423)
    #12 0x7f4be1ade9be in clone (/lib/x86_64-linux-gnu/libc.so.6+0xe89be)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/include/boost/asio/basic_socket.hpp:331:12 in boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::assign(boost::asio::ip::tcp const&, int const&, boost::system::error_code&)
Thread T1 created by T0 here:
    #0 0x52f699 in pthread_create (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x52f699)
    #1 0x7f4be3830478 in boost::thread::start_thread_noexcept() (/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.61.0+0x11478)
    #2 0x69ad0c in boost::thread::thread<void (cucumber::internal::SocketServer::*)(), cucumber::internal::SocketServer*>(void (cucumber::internal::SocketServer::*)(), cucumber::internal::SocketServer*, boost::disable_if<boost::thread_detail::is_convertible<void (cucumber::internal::SocketServer::*&)(), boost::thread_attributes>, boost::thread::dummy*>::type) /usr/include/boost/thread/detail/thread.hpp:393:13
    #3 0x60a87c in SocketServerTest::SetUp() /home/giel/git/cucumber-cpp/tests/integration/WireServerTest.cpp:69:32
    #4 0x78edca in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x78edca)
    #5 0x789735 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x789735)
    #6 0x76f2de in testing::Test::Run() (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x76f2de)
    #7 0x76fbaf in testing::TestInfo::Run() (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x76fbaf)
    #8 0x7701e1 in testing::TestCase::Run() (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x7701e1)
    #9 0x776ca8 in testing::internal::UnitTestImpl::RunAllTests() (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x776ca8)
    #10 0x78fc50 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x78fc50)
    #11 0x78a44f in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x78a44f)
    #12 0x7759bb in testing::UnitTest::Run() (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x7759bb)
    #13 0x7ac41f in RUN_ALL_TESTS() (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x7ac41f)
    #14 0x7ac3ae in main (/home/giel/git/cucumber-cpp/build/tests/WireServerTest+0x7ac3ae)
    #15 0x7f4be1a162b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    
==24457==ABORTING

When running in gdb I see that immediately after construction of the local variable stream in SocketServer::doAcceptOnce stream.rdbuf()->service_ is a pointer to 0x2. I'm not sure why I'm not seeing this without UBsan. The backtrace without UBsan is almost the same though:

$ gdb -ex run build-nosan/tests/WireServerTest
Running main() from gmock_main.cc
[==========] Running 4 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from TCPSocketServerTest
[ RUN      ] TCPSocketServerTest.exitsOnFirstConnectionClosed
[New Thread 0x7ffff3ae8700 (LWP 24637)]
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
  what():  accept: Already open

Thread 2 "WireServerTest" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff3ae8700 (LWP 24637)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
58      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
#1  0x00007ffff61c840a in __GI_abort () at abort.c:89
#2  0x00007ffff6ade07d in __gnu_cxx::__verbose_terminate_handler () at ../../../../src/libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007ffff6adc046 in __cxxabiv1::__terminate (handler=<optimized out>) at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007ffff6adc091 in std::terminate () at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007ffff6adc2a9 in __cxxabiv1::__cxa_throw (obj=0x7fffec000ba0,
    tinfo=0x540e50 <typeinfo for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >>,
    dest=0x4d81d0 <boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >::~clone_impl()>) at ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:87
#6  0x00000000004d810d in boost::throw_exception<boost::system::system_error> (e=...) at /usr/include/boost/throw_exception.hpp:69
#7  0x00000000004e749f in boost::asio::detail::do_throw_error (err=..., location=0x54460e "accept") at /usr/include/boost/asio/detail/impl/throw_error.ipp:38
#8  0x00000000004e7450 in boost::asio::detail::throw_error (err=..., location=0x54460e "accept") at /usr/include/boost/asio/detail/throw_error.hpp:42
#9  0x00000000004f74dd in boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >::accept<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> > (this=0x7a05e0, peer=...) at /usr/include/boost/asio/basic_socket_acceptor.hpp:932
#10 0x00000000004f5bd8 in cucumber::internal::SocketServer::doAcceptOnce<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > (this=0x7a05c0, acceptor=...)
    at /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:31
#11 0x00000000004f5507 in cucumber::internal::TCPSocketServer::acceptOnce (this=0x7a05c0) at /home/giel/git/cucumber-cpp/src/connectors/wire/WireServer.cpp:57
#12 0x00000000004dedd9 in boost::_mfi::mf0<void, cucumber::internal::SocketServer>::operator() (this=0x7a0a98, p=0x7a05c0) at /usr/include/boost/bind/mem_fn_template.hpp:49
#13 0x00000000004ded40 in boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> >::operator()<boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list0> (this=0x7a0aa8, f=...,
    a=...) at /usr/include/boost/bind/bind.hpp:259
#14 0x00000000004decda in boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > >::operator() (this=0x7a0a98)
    at /usr/include/boost/bind/bind_template.hpp:20
#15 0x00000000004dd43c in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, cucumber::internal::SocketServer>, boost::_bi::list1<boost::_bi::value<cucumber::internal::SocketServer*> > > >::run (this=0x7a08e0) at /usr/include/boost/thread/detail/thread.hpp:116
#16 0x00007ffff7bc3116 in boost::(anonymous namespace)::thread_proxy (param=<optimized out>) at libs/thread/src/pthread/thread.cpp:171
#17 0x00007ffff6dd6424 in start_thread (arg=0x7ffff3ae8700) at pthread_create.c:333
#18 0x00007ffff627c9bf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

@muggenhor
Copy link
Contributor

Considering that the only reproduction scenario is with compiling some parts as C++11 and others as C++98 I believe this is a violation of the ODR (One Definition Rule). I.e. unless you work really hard to maintain binary compatibility between these two C++ versions, you just won't have it. I know that for glibc++ they do work hard at that and still don't succeed completely.

As such, I'm closing this issue. Feel free to reopen it if you can find a reproduction scenario that doesn't depend on compiling different parts with different C++ versions (or other options affecting the ABI).

konserw added a commit to konserw/cucumber-cpp that referenced this issue Aug 23, 2017
Implementation based on temporary file.
Unit tests included.
When building QtTest driver C++11 is enabled globally to prevent issue cucumber#141.
@konserw konserw mentioned this issue Aug 23, 2017
9 tasks
konserw added a commit to konserw/cucumber-cpp that referenced this issue Aug 25, 2017
Implementation based on temporary file.
Unit tests included.
When building QtTest driver C++11 is enabled globally to prevent issue cucumber#141.
konserw added a commit to konserw/cucumber-cpp that referenced this issue Aug 25, 2017
Implementation based on temporary file.
When building QtTest driver C++11 is enabled
globally to prevent issue cucumber#141.
konserw added a commit to konserw/cucumber-cpp that referenced this issue Sep 13, 2017
Implementation based on temporary file.
When building QtTest driver C++11 is enabled
globally to prevent issue cucumber#141.
konserw added a commit to konserw/cucumber-cpp that referenced this issue Oct 12, 2017
Implementation based on temporary file.
When building QtTest driver C++11 is enabled
globally to prevent issue cucumber#141.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants