ethereum / aleth

Aleth – Ethereum C++ client, tools and libraries
GNU General Public License v3.0
3.97k stars 2.17k forks source link

ThreadSanitizer reports data race in LevelDB during sync #4740

Open gumb0 opened 6 years ago

gumb0 commented 6 years ago

This can happen when commiting new state data to StateDB while preparing response to GetNodeDataPacket network message (looking up data in StateDB)

Data race is reported inside LevelDB, so I'm not sure yet what we should do

==================
WARNING: ThreadSanitizer: data race (pid=93740)
  Read of size 1 at 0x7b8000281001 by thread T5:
    #0 memcmp ??:? (eth+0x4bad02)
    #1 leveldb::Comparator::~Comparator() ??:? (libleveldb.so.1+0x37ced)
    #2 (anonymous namespace)::EthereumHostData::nodeData(dev::RLP const&) const /home/ethnode/cpp-ethereum/libethereum/EthereumHost.cpp:328 (eth+0x6fc045)
    #3 dev::eth::EthereumPeer::interpret(unsigned int, dev::RLP const&) /home/ethnode/cpp-ethereum/libethereum/EthereumPeer.cpp:371 (eth+0x71794e)
    #4 dev::p2p::Session::readPacket(unsigned short, dev::p2p::PacketType, dev::RLP const&) /home/ethnode/cpp-ethereum/libp2p/Session.cpp:126 (eth+0x9e855d)
    #5 operator() /home/ethnode/cpp-ethereum/libp2p/Session.cpp:384 (eth+0x9ee2c5)
    #6 boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>::operator()(boost::system::error_code const&, unsigned long, int) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/impl/read.hpp:282 (eth+0x9ee2c5)
    #7 boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>::operator()() /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/bind_handler.hpp:127 (eth+0x9ee94f)
    #8 void boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, ...) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/handler_invoke_hook.hpp:69 (eth+0x9ee94f)
    #9 void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>, {lambda(boost::system::error_code, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, {lambda(boost::system::error_code, unsigned long)#1}&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/handler_invoke_helpers.hpp:37 (eth+0x9ee94f)
    #10 void boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, {lambda(boost::system::error_code, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, {lambda(boost::system::error_code, unsigned long)#1}>*) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/impl/read.hpp:502 (eth+0x9ee94f)
    #11 void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/handler_invoke_helpers.hpp:37 (eth+0x9ee94f)
    #12 boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}> >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/reactive_socket_recv_op.hpp:110 (eth+0x9ee94f)
    #13 boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/task_io_service_operation.hpp:38 (eth+0x995351)
    #14 boost::asio::detail::epoll_reactor::descriptor_state::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/impl/epoll_reactor.ipp:704 (eth+0x995351)
    #15 boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/task_io_service_operation.hpp:38 (eth+0x98a321)
    #16 boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service_thread_info&, boost::system::error_code const&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/impl/task_io_service.ipp:372 (eth+0x98a321)
    #17 boost::asio::detail::task_io_service::run(boost::system::error_code&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/impl/task_io_service.ipp:149 (eth+0x989c70)
    #18 boost::asio::io_service::run() /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/impl/io_service.ipp:59 (eth+0x97571c)
    #19 dev::p2p::Host::doWork() /home/ethnode/cpp-ethereum/libp2p/Host.cpp:775 (eth+0x97571c)
    #20 dev::Worker::workLoop() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:140 (eth+0x8d346e)
    #21 operator() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:62 (eth+0x8d387b)
    #22 void std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731 (eth+0x8d387b)
    #23 std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720 (eth+0x8d387b)
    #24 std::thread::_Impl<std::_Bind_simple<dev::Worker::startWorking()::$_0 ()> >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115 (eth+0x8d387b)
    #25 std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ??:? (libstdc++.so.6+0xb1a5f)

  Previous write of size 1 at 0x7b8000281001 by thread T4:
    #0 memcpy ??:? (eth+0x48ed4c)
    #1 leveldb::MemTable::Add(unsigned long, leveldb::ValueType, leveldb::Slice const&, leveldb::Slice const&) ??:? (libleveldb.so.1+0x207dd)
    #2 dev::eth::Block::cleanup() /home/ethnode/cpp-ethereum/libethereum/Block.cpp:900 (eth+0x5c7693)
    #3 dev::eth::BlockChain::import(dev::eth::VerifiedBlockRef const&, dev::OverlayDB const&, bool) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:698 (eth+0x61cbd9)
    #4 dev::eth::BlockChain::sync(dev::eth::BlockQueue&, dev::OverlayDB const&, unsigned int) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:465 (eth+0x619baa)
    #5 dev::eth::Client::syncBlockQueue() /home/ethnode/cpp-ethereum/libethereum/Client.cpp:395 (eth+0x6c673c)
    #6 dev::eth::Client::doWork(bool) /home/ethnode/cpp-ethereum/libethereum/Client.cpp:665 (eth+0x6c177a)
    #7 dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:250 (eth+0x6d91d5)
    #8 non-virtual thunk to dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:? (eth+0x6d91d5)
    #9 dev::Worker::workLoop() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:140 (eth+0x8d346e)
    #10 operator() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:62 (eth+0x8d387b)
    #11 void std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731 (eth+0x8d387b)
    #12 std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720 (eth+0x8d387b)
    #13 std::thread::_Impl<std::_Bind_simple<dev::Worker::startWorking()::$_0 ()> >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115 (eth+0x8d387b)
    #14 std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ??:? (libstdc++.so.6+0xb1a5f)

  Location is heap block of size 4096 at 0x7b8000281000 allocated by thread T4:
    #0 operator new[](unsigned long) ??:? (eth+0x5191d3)
    #1 leveldb::Arena::AllocateNewBlock(unsigned long) ??:? (libleveldb.so.1+0x366a3)
    #2 dev::eth::Block::cleanup() /home/ethnode/cpp-ethereum/libethereum/Block.cpp:900 (eth+0x5c7693)
    #3 dev::eth::BlockChain::import(dev::eth::VerifiedBlockRef const&, dev::OverlayDB const&, bool) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:698 (eth+0x61cbd9)
    #4 dev::eth::BlockChain::sync(dev::eth::BlockQueue&, dev::OverlayDB const&, unsigned int) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:465 (eth+0x619baa)
    #5 dev::eth::Client::syncBlockQueue() /home/ethnode/cpp-ethereum/libethereum/Client.cpp:395 (eth+0x6c673c)
    #6 dev::eth::Client::doWork(bool) /home/ethnode/cpp-ethereum/libethereum/Client.cpp:665 (eth+0x6c177a)
    #7 dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:250 (eth+0x6d91d5)
    #8 non-virtual thunk to dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:? (eth+0x6d91d5)
    #9 dev::Worker::workLoop() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:140 (eth+0x8d346e)
    #10 operator() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:62 (eth+0x8d387b)
    #11 void std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731 (eth+0x8d387b)
    #12 std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720 (eth+0x8d387b)
    #13 std::thread::_Impl<std::_Bind_simple<dev::Worker::startWorking()::$_0 ()> >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115 (eth+0x8d387b)
    #14 std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ??:? (libstdc++.so.6+0xb1a5f)

  Thread T5 'p2p' (tid=93747, running) created by main thread at:
    #0 pthread_create ??:? (eth+0x48e416)
    #1 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) ??:? (libstdc++.so.6+0xb1cae)
    #2 dev::p2p::Host::start() /home/ethnode/cpp-ethereum/libp2p/Host.cpp:128 (eth+0x966ca6)
    #3 dev::WebThreeDirect::startNetwork() /home/ethnode/cpp-ethereum/libwebthree/WebThree.h:202 (eth+0x5358ab)
    #4 main /home/ethnode/cpp-ethereum/eth/main.cpp:1064 (eth+0x5358ab)

  Thread T4 'eth' (tid=93746, running) created by main thread at:
    #0 pthread_create ??:? (eth+0x48e416)
    #1 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) ??:? (libstdc++.so.6+0xb1cae)
    #2 dev::eth::Client::startWorking() /home/ethnode/cpp-ethereum/libethereum/Client.h:212 (eth+0x8a2c78)
    #3 WebThreeDirect /home/ethnode/cpp-ethereum/libwebthree/WebThree.cpp:64 (eth+0x8a2c78)
    #4 main /home/ethnode/cpp-ethereum/eth/main.cpp:874 (eth+0x532d75)

SUMMARY: ThreadSanitizer: data race ??:? in __interceptor_memcmp
gumb0 commented 6 years ago

Could be the reason for https://github.com/ethereum/cpp-ethereum/issues/4578

gumb0 commented 6 years ago

Using bitcoin-core's newer LevelDB gives me slightly different but similar reports:

==================                                                                                                                                                                                                                                                                                           [376/1956]WARNING: ThreadSanitizer: data race (pid=98884)
  Read of size 1 at 0x7b80002b6f0a by thread T5:
    #0 memcmp ??:? (eth+0x4bad22)
    #1 leveldb::(anonymous namespace)::BytewiseComparatorImpl::Compare(leveldb::Slice const&, leveldb::Slice const&) const comparator.cc:? (libleveldb.so.1+0x3e318)
    #2 (anonymous namespace)::EthereumHostData::nodeData(dev::RLP const&) const /home/ethnode/cpp-ethereum/libethereum/EthereumHost.cpp:328 (eth+0x6fc065)
    #3 dev::eth::EthereumPeer::interpret(unsigned int, dev::RLP const&) /home/ethnode/cpp-ethereum/libethereum/EthereumPeer.cpp:371 (eth+0x71796e)
    #4 dev::p2p::Session::readPacket(unsigned short, dev::p2p::PacketType, dev::RLP const&) /home/ethnode/cpp-ethereum/libp2p/Session.cpp:126 (eth+0x9e85dd)
    #5 operator() /home/ethnode/cpp-ethereum/libp2p/Session.cpp:384 (eth+0x9ee345)
    #6 boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>::operator()(boost::system::error_code const&, unsigned long, int) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/impl/read.hpp:282 (eth+0x9ee345)
    #7 boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>::operator()() /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/bind_handler.hpp:127 (eth+0x9ee9cf)
    #8 void boost::asio::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long> >(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, ...) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/handler_invoke_hook.hpp:69 (eth+0x9ee9cf)
    #9 void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>, {lambda(boost::system::error_code, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, {lambda(boost::system::error_code, unsigned long)#1}&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/handler_invoke_helpers.hpp:37 (eth+0x9ee9cf)
    #10 void boost::asio::detail::asio_handler_invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, {lambda(boost::system::error_code, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, {lambda(boost::system::error_code, unsigned long)#1}>*) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/impl/read.hpp:502 (eth+0x9ee9cf)
    #11 void boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>(boost::asio::detail::binder2<boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}>, boost::system::error_code, unsigned long>&, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/handler_invoke_helpers.hpp:37 (eth+0x9ee9cf)
    #12 boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::asio::detail::read_op<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::mutable_buffers_1, boost::asio::detail::transfer_all_t, dev::p2p::Session::doRead()::$_1::operator()(boost::system::error_code, unsigned long) const::{lambda(boost::system::error_code, unsigned long)#1}> >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/reactive_socket_recv_op.hpp:110 (eth+0x9ee9cf)
    #13 boost::asio::detail::task_io_service_operation::complete(boost::asio::detail::task_io_service&, boost::system::error_code const&, unsigned long) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/task_io_service_operation.hpp:38 (eth+0x98a3a1)
    #14 boost::asio::detail::task_io_service::do_run_one(boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex>&, boost::asio::detail::task_io_service_thread_info&, boost::system::error_code const&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/impl/task_io_service.ipp:372 (eth+0x98a3a1)
    #15 boost::asio::detail::task_io_service::run(boost::system::error_code&) /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/detail/impl/task_io_service.ipp:149 (eth+0x989cf0)
    #16 boost::asio::io_service::run() /home/ethnode/.hunter/_Base/750fb1d/1a3071a/94374ad/Install/include/boost/asio/impl/io_service.ipp:59 (eth+0x97579c)
    #17 dev::p2p::Host::doWork() /home/ethnode/cpp-ethereum/libp2p/Host.cpp:775 (eth+0x97579c)
    #18 dev::Worker::workLoop() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:140 (eth+0x8d34ee)
    #19 operator() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:62 (eth+0x8d38fb)
    #20 void std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731 (eth+0x8d38fb)
    #21 std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720 (eth+0x8d38fb)
    #22 std::thread::_Impl<std::_Bind_simple<dev::Worker::startWorking()::$_0 ()> >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115 (eth+0x8d38fb)
    #23 std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ??:? (libstdc++.so.6+0xb1a5f)

  Previous write of size 1 at 0x7b80002b6f0a by thread T4:
    #0 memcpy ??:? (eth+0x48ed6c)
    #1 leveldb::MemTable::Add(unsigned long, leveldb::ValueType, leveldb::Slice const&, leveldb::Slice const&) ??:? (libleveldb.so.1+0x25ced)
    #2 dev::eth::Block::cleanup() /home/ethnode/cpp-ethereum/libethereum/Block.cpp:900 (eth+0x5c76b3)
    #3 dev::eth::BlockChain::import(dev::eth::VerifiedBlockRef const&, dev::OverlayDB const&, bool) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:698 (eth+0x61cbf9)
    #4 dev::eth::BlockChain::sync(dev::eth::BlockQueue&, dev::OverlayDB const&, unsigned int) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:465 (eth+0x619bca)
    #5 dev::eth::Client::syncBlockQueue() /home/ethnode/cpp-ethereum/libethereum/Client.cpp:395 (eth+0x6c675c)
    #6 dev::eth::Client::doWork(bool) /home/ethnode/cpp-ethereum/libethereum/Client.cpp:665 (eth+0x6c179a)
    #7 dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:250 (eth+0x6d91f5)
    #8 non-virtual thunk to dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:? (eth+0x6d91f5)
    #9 dev::Worker::workLoop() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:140 (eth+0x8d34ee)
    #10 operator() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:62 (eth+0x8d38fb)
    #11 void std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731 (eth+0x8d38fb)
    #12 std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720 (eth+0x8d38fb)
    #13 std::thread::_Impl<std::_Bind_simple<dev::Worker::startWorking()::$_0 ()> >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115 (eth+0x8d38fb)
    #14 std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ??:? (libstdc++.so.6+0xb1a5f)

  Location is heap block of size 4096 at 0x7b80002b6000 allocated by thread T4:
    #0 operator new[](unsigned long) ??:? (eth+0x5191f3)
    #1 leveldb::Arena::AllocateNewBlock(unsigned long) ??:? (libleveldb.so.1+0x3cad3)
    #2 dev::eth::Block::cleanup() /home/ethnode/cpp-ethereum/libethereum/Block.cpp:900 (eth+0x5c76b3)
    #3 dev::eth::BlockChain::import(dev::eth::VerifiedBlockRef const&, dev::OverlayDB const&, bool) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:698 (eth+0x61cbf9)
    #4 dev::eth::BlockChain::sync(dev::eth::BlockQueue&, dev::OverlayDB const&, unsigned int) /home/ethnode/cpp-ethereum/libethereum/BlockChain.cpp:465 (eth+0x619bca)
    #5 dev::eth::Client::syncBlockQueue() /home/ethnode/cpp-ethereum/libethereum/Client.cpp:395 (eth+0x6c675c)
    #6 dev::eth::Client::doWork(bool) /home/ethnode/cpp-ethereum/libethereum/Client.cpp:665 (eth+0x6c179a)
    #7 dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:250 (eth+0x6d91f5)
    #8 non-virtual thunk to dev::eth::Client::doWork() /home/ethnode/cpp-ethereum/libethereum/Client.h:? (eth+0x6d91f5)
    #9 dev::Worker::workLoop() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:140 (eth+0x8d34ee)
    #10 operator() /home/ethnode/cpp-ethereum/libdevcore/Worker.cpp:62 (eth+0x8d38fb)
    #11 void std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::_M_invoke<>(std::_Index_tuple<>) /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1731 (eth+0x8d38fb)
    #12 std::_Bind_simple<dev::Worker::startWorking()::$_0 ()>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:1720 (eth+0x8d38fb)
    #13 std::thread::_Impl<std::_Bind_simple<dev::Worker::startWorking()::$_0 ()> >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:115 (eth+0x8d38fb)
    #14 std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >) ??:? (libstdc++.so.6+0xb1a5f)

  Thread T5 'p2p' (tid=98891, running) created by main thread at:
    #0 pthread_create ??:? (eth+0x48e436)
    #1 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) ??:? (libstdc++.so.6+0xb1cae)
    #2 dev::p2p::Host::start() /home/ethnode/cpp-ethereum/libp2p/Host.cpp:128 (eth+0x966d26)
    #3 dev::WebThreeDirect::startNetwork() /home/ethnode/cpp-ethereum/libwebthree/WebThree.h:202 (eth+0x5358cb)
    #4 main /home/ethnode/cpp-ethereum/eth/main.cpp:1064 (eth+0x5358cb)

  Thread T4 'eth' (tid=98889, running) created by main thread at:
    #0 pthread_create ??:? (eth+0x48e436)
    #1 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) ??:? (libstdc++.so.6+0xb1cae)
    #2 dev::eth::Client::startWorking() /home/ethnode/cpp-ethereum/libethereum/Client.h:212 (eth+0x8a2cf8)
    #3 WebThreeDirect /home/ethnode/cpp-ethereum/libwebthree/WebThree.cpp:64 (eth+0x8a2cf8)
    #4 main /home/ethnode/cpp-ethereum/eth/main.cpp:874 (eth+0x532d95)

SUMMARY: ThreadSanitizer: data race ??:? in __interceptor_memcmp
==================
gumb0 commented 6 years ago

Could it be false positive because of some tricky thread-safety handling inside LevelDB?