rsocket-cpp icon indicating copy to clipboard operation
rsocket-cpp copied to clipboard

Crash in Benchmarks - benchmarks/StreamThroughputMemory.cpp

Open phoad opened this issue 8 years ago • 2 comments

AddressSanitizer warns us about an error:

I0824 00:30:26.327633  9930 Benchmarks.cpp:11] Running benchmarks... (takes minutes)
I0824 00:30:26.681712  9930 StreamThroughputMemory.cpp:159]   Running with 100000 items
/home/travis/build/rsocket/rsocket-cpp/benchmarks/StreamThroughputMemory.cpp:57:19: runtime error: member access within null pointer of type '(anonymous namespace)::DirectDuplexConnection'
SUMMARY: AddressSanitizer: undefined-behavior /home/travis/build/rsocket/rsocket-cpp/benchmarks/StreamThroughputMemory.cpp:57:19 in 
ASAN:DEADLYSIGNAL
=================================================================
==9930==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x0000006e0bea bp 0x2abd65f17fb0 sp 0x2abd65f17b40 T2)
==9930==The signal is caused by a READ memory access.
==9930==Hint: address points to the zero page.
    #0 0x6e0be9 in (anonymous namespace)::DirectDuplexConnection::getOutput()::{lambda(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >)#1}::operator()(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >) const /home/travis/build/rsocket/rsocket-cpp/benchmarks/StreamThroughputMemory.cpp:57:19
    #1 0x6de1ea in yarpl::flowable::Subscribers::Base<std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >, (anonymous namespace)::DirectDuplexConnection::getOutput()::{lambda(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >)#1}>::onNext(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >) /home/travis/build/rsocket/rsocket-cpp/yarpl/include/yarpl/flowable/Subscribers.h:82:7
    #2 0x10385cc in rsocket::FramedWriter::onNext(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >) /home/travis/build/rsocket/rsocket-cpp/rsocket/framing/FramedWriter.cpp:94:12
    #3 0xf93464 in rsocket::FrameTransport::outputFrameOrDrop(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >) /home/travis/build/rsocket/rsocket-cpp/rsocket/framing/FrameTransport.cpp:156:22
    #4 0xcefa43 in rsocket::RSocketStateMachine::outputFrame(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >) /home/travis/build/rsocket/rsocket-cpp/rsocket/statemachine/RSocketStateMachine.cpp:858:20
    #5 0xcf6eab in rsocket::RSocketStateMachine::connectClientSendSetup(std::unique_ptr<rsocket::DuplexConnection, std::default_delete<rsocket::DuplexConnection> >, rsocket::SetupParameters) /home/travis/build/rsocket/rsocket-cpp/rsocket/statemachine/RSocketStateMachine.cpp:919:3
    #6 0xaaf0b3 in rsocket::RSocketClient::fromConnection(std::unique_ptr<rsocket::DuplexConnection, std::default_delete<rsocket::DuplexConnection> >, folly::EventBase&) /home/travis/build/rsocket/rsocket-cpp/rsocket/RSocketClient.cpp:144:18
    #7 0xacfbfb in rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}::operator()() /home/travis/build/rsocket/rsocket-cpp/rsocket/RSocketClient.cpp:60:7
    #8 0xacf63b in auto folly::detail::CoreCallbackState<folly::Unit, rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}>::invoke<>() /home/travis/folly/include/folly/futures/Future-inl.h:84:12
    #9 0xacf14c in std::enable_if<!folly::detail::callableResult<folly::Unit, {lambda()#1}>::ReturnsFuture::value, std::enable_if::Return>::type folly::Future<folly::Unit>::thenImplementation<rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}, folly::detail::callableResult<folly::Unit, {lambda()#1}>, false>(rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}&&, rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}::argResult<false, std::enable_if<!folly::detail::callableResult<folly::Unit, {lambda()#1}>::ReturnsFuture::value, std::enable_if::Return>>)::{lambda(folly::Try<folly::Unit>&&)#1}::operator()(folly::Try)::{lambda()#1}::operator()() const /home/travis/folly/include/folly/futures/Future-inl.h:289:34
    #10 0xace552 in _ZN5folly11makeTryWithIZZNS_6FutureINS_4UnitEE18thenImplementationIZZN7rsocket13RSocketClient7connectEvEN3$_1clENS5_17ConnectionFactory25ConnectedDuplexConnectionEEUlvE_NS_6detail14callableResultIS2_SA_EELb0EJEEENSt9enable_ifIXntsrNT0_13ReturnsFutureE5valueENSF_6ReturnEE4typeEOT_NSB_9argResultIXT1_ESJ_JDpT2_EEEENUlONS_3TryIS2_EEE_clESR_EUlvE_EENSE_IXsr3std7is_sameINSt9result_ofIFSJ_vEE4typeEvEE5valueENSP_IvEEE4typeESK_ /home/travis/folly/include/folly/Try-inl.h:165:5
    #11 0xacd124 in std::enable_if<!folly::detail::callableResult<folly::Unit, {lambda()#1}>::ReturnsFuture::value, std::enable_if::Return>::type folly::Future<folly::Unit>::thenImplementation<rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}, folly::detail::callableResult<folly::Unit, {lambda()#1}>, false>(rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}&&, rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}::argResult<false, std::enable_if<!folly::detail::callableResult<folly::Unit, {lambda()#1}>::ReturnsFuture::value, std::enable_if::Return>>)::{lambda(folly::Try<folly::Unit>&&)#1}::operator()(folly::Try) /home/travis/folly/include/folly/futures/Future-inl.h:288:24
    #12 0xaca33a in void folly::detail::function::FunctionTraits<void (folly::Try<folly::Unit>&&)>::callSmall<std::enable_if<!folly::detail::callableResult<folly::Unit, {lambda()#1}>::ReturnsFuture::value, std::enable_if::Return>::type folly::Future<folly::Unit>::thenImplementation<rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}, folly::detail::callableResult<folly::Unit, {lambda()#1}>, false>(rsocket::RSocketClient::connect()::$_1::operator()(rsocket::ConnectionFactory::ConnectedDuplexConnection)::{lambda()#1}&&, folly::detail::argResult<false, std::enable_if<!folly::detail::callableResult<folly::Unit, {lambda()#1}>::ReturnsFuture::value, std::enable_if::Return>>)::{lambda(folly::Try<folly::Unit>&&)#1}>(folly::detail::function::Data&, folly::Try<folly::Unit>&&) /home/travis/folly/include/folly/Function.h:298:36
    #13 0x8308bd in folly::detail::function::FunctionTraits<void (folly::Try<folly::Unit>&&)>::operator()(folly::Try<folly::Unit>&&) /home/travis/folly/include/folly/Function.h:314:12
    #14 0x834969 in folly::detail::Core<folly::Unit>::doCallback()::{lambda()#1}::operator()() /home/travis/folly/include/folly/futures/detail/Core.h:369:13
    #15 0x833344 in void folly::detail::function::FunctionTraits<void ()>::callSmall<folly::detail::Core<folly::Unit>::doCallback()::{lambda()#1}>(folly::detail::function::Data&) /home/travis/folly/include/folly/Function.h:298:36
    #16 0x2abd5d4e179a in folly::detail::function::FunctionTraits<void ()>::operator()() /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/./../folly/Function.h:314:12
    #17 0x2abd5d4e179a in folly::EventBase::FunctionLoopCallback::runLoopCallback() /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/./../folly/io/async/EventBase.h:175
    #18 0x2abd5d4dde28 in folly::EventBase::runLoopCallbacks() /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/io/async/EventBase.cpp:623:17
    #19 0x2abd5d4de7ea in folly::EventBase::loopBody(int) /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/io/async/EventBase.cpp:319:24
    #20 0x2abd5d4df343 in folly::EventBase::loop() /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/io/async/EventBase.cpp:253:10
    #21 0x2abd5d4df343 in folly::EventBase::loopForever() /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/io/async/EventBase.cpp:451
    #22 0x2abd5d4ee94b in folly::run(folly::EventBaseManager*, folly::EventBase*, folly::Baton<std::atomic, true, true>*, folly::Range<char const*> const&) /home/travis/build/rsocket/rsocket-cpp/build/folly-ext-prefix/src/folly-ext/folly/io/async/ScopedEventBaseThread.cpp:40:7
    #23 0x2abd5ddc25af  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x915af)
    #24 0x2abd5db1b183 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8183)
    #25 0x2abd5ea6affc in clone (/lib/x86_64-linux-gnu/libc.so.6+0xfdffc)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/travis/build/rsocket/rsocket-cpp/benchmarks/StreamThroughputMemory.cpp:57:19 in (anonymous namespace)::DirectDuplexConnection::getOutput()::{lambda(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >)#1}::operator()(std::unique_ptr<folly::IOBuf, std::default_delete<folly::IOBuf> >) const
Thread T2 created by T0 here:
    #0 0x5dd791 in pthread_create (/home/travis/build/rsocket/rsocket-cpp/build/benchmarks/stream-throughput-mem+0x5dd791)
    #1 0x2abd5ddc26f2 in std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0x916f2)
==9930==ABORTING
83% tests passed, 1 tests failed out of 6
Total Test time (real) =  59.02 sec
The following tests FAILED:
	  6 - StreamThroughputMemoryTest (Failed)
Errors while running CTest
make: *** [test] Error 8

phoad avatar Aug 24 '17 00:08 phoad

I'm still hitting this too, as well as a heap use after free. This bench seems flakey.

dymk avatar Aug 29 '17 17:08 dymk

@dymk It was disabled recently (https://github.com/rsocket/rsocket-cpp/blob/master/benchmarks/CMakeLists.txt#L26), have you rebased or are you running it manually?

alexmalyshev avatar Aug 29 '17 18:08 alexmalyshev