Skip to content
  • Georgios Bitzes's avatar
    FUSEX: Prevent unsynchronized access to ChunkMap, add missing read lock · 578bd8ce
    Georgios Bitzes authored
    WARNING: ThreadSanitizer: data race (pid=27564)
      Write of size 8 at 0x7b6c000464d8 by thread T3 (mutexes: write M69597):
        #0 std::_Rb_tree<unsigned long, std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> >, std::_Select1st<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >) /usr/include/c++/7/bits/stl_tree.h:2478 (eosxd+0x0000006f35a6)
        #1 std::_Rb_tree<unsigned long, std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> >, std::_Select1st<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >, std::_Rb_tree_const_iterator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >) /usr/include/c++/7/bits/stl_tree.h:2491 (eosxd+0x0000006f35a6)
        #2 std::_Rb_tree<unsigned long, std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> >, std::_Select1st<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > > >::erase(unsigned long const&) /usr/include/c++/7/bits/stl_tree.h:2502 (eosxd+0x0000006f35a6)
        #3 std::map<unsigned long, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler>, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > > >::erase(unsigned long const&) /usr/include/c++/7/bits/stl_map.h:1063 (eosxd+0x0000006ef7cf)
        #4 XrdCl::Proxy::WriteAsyncHandler::HandleResponse(XrdCl::XRootDStatus*, XrdCl::AnyObject*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/data/xrdclproxy.cc:799 (eosxd+0x0000006ef7cf)
        #5 XrdCl::ResponseHandler::HandleResponseWithHosts(XrdCl::XRootDStatus*, XrdCl::AnyObject*, std::vector<XrdCl::HostInfo, std::allocator<XrdCl::HostInfo> >*) /usr/include/xrootd/XrdCl/XrdClXRootDResponses.hh:852 (eosxd+0x0000006e3f05)
        #6 <null> <null> (libXrdCl.so.2+0x0000000d03f7)
        #7 XrdCl::XRootDMsgHandler::HandleResponse() <null> (libXrdCl.so.2+0x000000098b19)
        #8 XrdCl::XRootDMsgHandler::Process(XrdCl::Message*) <null> (libXrdCl.so.2+0x00000009d3a1)
        #9 XrdCl::Stream::HandleIncMsgJob::Run(void*) <null> (libXrdCl.so.2+0x00000006d5ff)
        #10 XrdCl::JobManager::RunJobs() <null> (libXrdCl.so.2+0x00000011f67f)
        #11 <null> <null> (libXrdCl.so.2+0x00000011f775)
        #12 <null> <null> (libtsan.so.0+0x0000000257eb)
    
      Previous read of size 8 at 0x7b6c000464d8 by thread T4:
        #0 std::map<unsigned long, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler>, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > > >::size() const /usr/include/c++/7/bits/stl_map.h:463 (eosxd+0x0000006ef4bb)
        #1 XrdCl::Proxy::WriteAsyncHandler::HandleResponse(XrdCl::XRootDStatus*, XrdCl::AnyObject*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/data/xrdclproxy.cc:782 (eosxd+0x0000006ef4bb)
        #2 XrdCl::ResponseHandler::HandleResponseWithHosts(XrdCl::XRootDStatus*, XrdCl::AnyObject*, std::vector<XrdCl::HostInfo, std::allocator<XrdCl::HostInfo> >*) /usr/include/xrootd/XrdCl/XrdClXRootDResponses.hh:852 (eosxd+0x0000006e3f05)
        #3 <null> <null> (libXrdCl.so.2+0x0000000d03f7)
        #4 XrdCl::XRootDMsgHandler::HandleResponse() <null> (libXrdCl.so.2+0x000000098b19)
        #5 XrdCl::XRootDMsgHandler::Process(XrdCl::Message*) <null> (libXrdCl.so.2+0x00000009d3a1)
        #6 XrdCl::Stream::HandleIncMsgJob::Run(void*) <null> (libXrdCl.so.2+0x00000006d5ff)
        #7 XrdCl::JobManager::RunJobs() <null> (libXrdCl.so.2+0x00000011f67f)
        #8 <null> <null> (libXrdCl.so.2+0x00000011f775)
        #9 <null> <null> (libtsan.so.0+0x0000000257eb)
    
      Location is heap block of size 1712 at 0x7b6c00046000 allocated by thread T27:
        #0 operator new(unsigned long) <null> (libtsan.so.0+0x00000006f766)
        #1 data::datax::attach(fuse_req*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/data/data.cc:577 (eosxd+0x0000006a656e)
        #2 EosFuse::create(fuse_req*, unsigned long, char const*, unsigned int, fuse_file_info*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/eosfuse.cc:3410 (eosxd+0x0000005fa699)
        #3 <null> <null> (libfuse.so.2+0x0000000151a6)
    
      Mutex M69597 (0x7b6c00046410) created at:
        #0 pthread_mutex_init <null> (libtsan.so.0+0x00000002971e)
        #1 XrdSysCondVar::XrdSysCondVar(int, char const*) /usr/include/xrootd/XrdSys/XrdSysPthread.hh:78 (eosxd+0x0000006b12b6)
        #2 XrdCl::Proxy::Proxy() /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/./data/xrdclproxy.hh:546 (eosxd+0x0000006b12b6)
        #3 data::datax::attach(fuse_req*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/data/data.cc:577 (eosxd+0x0000006a657d)
        #4 EosFuse::create(fuse_req*, unsigned long, char const*, unsigned int, fuse_file_info*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/fusex/eosfuse.cc:3410 (eosxd+0x0000005fa699)
        #5 <null> <null> (libfuse.so.2+0x0000000151a6)
    
      Thread T3 (tid=27572, running) created by main thread at:
        #0 pthread_create <null> (libtsan.so.0+0x000000028e03)
        #1 XrdCl::JobManager::Start() <null> (libXrdCl.so.2+0x00000011f45a)
        #2 XrdCl::PostMaster::Start() <null> (libXrdCl.so.2+0x000000061e31)
        #3 XrdCl::DefaultEnv::GetPostMaster() <null> (libXrdCl.so.2+0x000000044354)
        #4 <null> <null> (libXrdCl.so.2+0x000000032365)
        #5 call_init.part.0 <null> (ld-linux-x86-64.so.2+0x00000000f529)
    
      Thread T4 (tid=27573, running) created by main thread at:
        #0 pthread_create <null> (libtsan.so.0+0x000000028e03)
        #1 XrdCl::JobManager::Start() <null> (libXrdCl.so.2+0x00000011f45a)
        #2 XrdCl::PostMaster::Start() <null> (libXrdCl.so.2+0x000000061e31)
        #3 XrdCl::DefaultEnv::GetPostMaster() <null> (libXrdCl.so.2+0x000000044354)
        #4 <null> <null> (libXrdCl.so.2+0x000000032365)
        #5 call_init.part.0 <null> (ld-linux-x86-64.so.2+0x00000000f529)
    
      Thread T27 (tid=28416, running) created by thread T24 at:
        #0 pthread_create <null> (libtsan.so.0+0x000000028e03)
        #1 <null> <null> (libfuse.so.2+0x000000013134)
    
    SUMMARY: ThreadSanitizer: data race /usr/include/c++/7/bits/stl_tree.h:2478 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> >, std::_Select1st<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<unsigned long const, std::shared_ptr<XrdCl::Proxy::WriteAsyncHandler> > >)
    578bd8ce