Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1887

TSan error on errno in sync tests

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      From https://spruce.mongodb.com/task/realm_core_stable_macos_1100_arm64_tsan_sync_tests_patch_2e6629522509993e9e040163643fbf8e35da92aa_6558f0927742aedfff219241_23_11_18_17_12_51/logs?execution=0&sortBy=STATUS&sortDir=ASC:

      [2023/11/18 12:21:55.197] 2: WARNING: ThreadSanitizer: data race (pid=58000)
      [2023/11/18 12:21:55.197] 2:   Read of size 4 at 0x00016f80b0ac by thread T65:
      [2023/11/18 12:21:55.197] 2:     #0 realm::sync::network::Service::Descriptor::accept(realm::sync::network::Service::Descriptor&, realm::sync::network::StreamProtocol, realm::sync::network::Endpoint*, std::__1::error_code&) network.cpp:1861 (realm-sync-tests:arm64+0x10030410c)
      [2023/11/18 12:21:55.197] 2:     #1 realm::sync::network::Acceptor::AcceptOperBase::advance() network.hpp:3364 (realm-sync-tests:arm64+0x1001d13d8)
      [2023/11/18 12:21:55.197] 2:     #2 realm::sync::network::Service::IoReactor::advance_active_ops(realm::sync::network::Service::OperQueue<realm::sync::network::Service::AsyncOper>&) network.cpp:935 (realm-sync-tests:arm64+0x100302b00)
      [2023/11/18 12:21:55.197] 2:     #3 realm::sync::network::Service::Impl::run_impl(bool) network.cpp:1611 (realm-sync-tests:arm64+0x1003077f4)
      [2023/11/18 12:21:55.197] 2:     #4 realm::sync::network::Service::run() network.cpp:1770 (realm-sync-tests:arm64+0x1003036bc)
      [2023/11/18 12:21:55.197] 2:     #5 realm::sync::Server::run() server.cpp:4816 (realm-sync-tests:arm64+0x10026aa60)
      [2023/11/18 12:21:55.197] 2:     #6 realm::fixtures::MultiClientServerFixture::run_server(int)::'lambda0'()::operator()() const sync_fixtures.hpp:846 (realm-sync-tests:arm64+0x100037970)
      [2023/11/18 12:21:55.197] 2:     #7 realm::fixtures::MultiClientServerFixture::run_server(int) sync_fixtures.hpp:846 (realm-sync-tests:arm64+0x100037754)
      [2023/11/18 12:21:55.197] 2:     #8 realm::test_util::ThreadWrapper::Runner<realm::fixtures::MultiClientServerFixture::start()::'lambda'()>::run(realm::fixtures::MultiClientServerFixture::start()::'lambda'(), realm::test_util::ThreadWrapper*) thread_wrapper.hpp:85 (realm-sync-tests:arm64+0x10003764c)
      [2023/11/18 12:21:55.197] 2:     #9 void* realm::util::Thread::entry_point<void realm::test_util::ThreadWrapper::start<realm::fixtures::MultiClientServerFixture::start()::'lambda'()>(realm::fixtures::MultiClientServerFixture::start()::'lambda'() const&)::'lambda'()>(void*) thread.hpp:483 (realm-sync-tests:arm64+0x1000375f4)
      [2023/11/18 12:21:55.197] 2:
      [2023/11/18 12:21:55.197] 2:   Previous write of size 4 at 0x00016f80b0ac by thread T1:
      [2023/11/18 12:21:55.197] 2:     #0 realm::util::DirScanner::next(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) file.cpp:1971 (realm-sync-tests:arm64+0x10061d22c)
      [2023/11/18 12:21:55.197] 2:     #1 realm::test_util::(anonymous namespace)::do_clean_dir(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) test_path.cpp:264 (realm-sync-tests:arm64+0x1002522f0)
      [2023/11/18 12:21:55.197] 2:     #2 realm::test_util::DBTestPathGuard::cleanup() const test_path.cpp:304 (realm-sync-tests:arm64+0x1002527c0)
      [2023/11/18 12:21:55.197] 2:     #3 realm::test_util::DBTestPathGuard::~DBTestPathGuard() test_path.cpp:294 (realm-sync-tests:arm64+0x100252bd0)
      [2023/11/18 12:21:55.197] 2:     #4 realm::test_util::Peer::~Peer() peer.hpp:511 (realm-sync-tests:arm64+0x10001821c)
      [2023/11/18 12:21:55.197] 2:     #5 realm::test_util::Associativity::Iteration::~Iteration() peer.hpp:774 (realm-sync-tests:arm64+0x10006b2c8)
      [2023/11/18 12:21:55.197] 2:     #6 realm::test_util::unit_test::RegisterTest<(anonymous namespace)::Realm_UnitTest__Transform_AddIntegerSurvivesSetDefault_NoRegularSets>::run_test(realm::test_util::unit_test::TestContext&) unit_test.hpp:640 (realm-sync-tests:arm64+0x1001a36d4)
      [2023/11/18 12:21:55.197] 2:     #7 realm::test_util::unit_test::TestList::ThreadContextImpl::run(realm::test_util::unit_test::TestList::SharedContextImpl::Entry, realm::util::UniqueLock&) unit_test.cpp:727 (realm-sync-tests:arm64+0x100256814)
      [2023/11/18 12:21:55.197] 2:     #8 realm::test_util::unit_test::TestList::ThreadContextImpl::run() unit_test.cpp:681 (realm-sync-tests:arm64+0x100256154)
      [2023/11/18 12:21:55.197] 2:     #9 void* realm::util::Thread::entry_point<realm::test_util::unit_test::TestList::run(realm::test_util::unit_test::TestList::Config)::$_1>(void*) thread.hpp:483 (realm-sync-tests:arm64+0x10025d04c)
      [2023/11/18 12:21:55.197] 2:
      [2023/11/18 12:21:55.197] 2:   Thread T65 (tid=5241499, running) created by thread T6 at:
      [2023/11/18 12:21:55.197] 2:     #0 pthread_create <null>:23328284 (libclang_rt.tsan_osx_dynamic.dylib:arm64e+0x2cda0)
      [2023/11/18 12:21:55.197] 2:     #1 realm::fixtures::MultiClientServerFixture::start() sync_fixtures.hpp:627 (realm-sync-tests:arm64+0x100031604)
      [2023/11/18 12:21:55.197] 2:     #2 (anonymous namespace)::Realm_UnitTest__Sync_HistoryMigration::test_run()::$_17::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const test_sync_history_migration.cpp:330 (realm-sync-tests:arm64+0x10014d178)
      [2023/11/18 12:21:55.197] 2:     #3 (anonymous namespace)::Realm_UnitTest__Sync_HistoryMigration::test_run()::$_18::operator()(int, int) const test_sync_history_migration.cpp:349 (realm-sync-tests:arm64+0x10014c1d4)
      [2023/11/18 12:21:55.197] 2:     #4 (anonymous namespace)::Realm_UnitTest__Sync_HistoryMigration::test_run()::$_18::operator()(int, int) const test_sync_history_migration.cpp:337 (realm-sync-tests:arm64+0x10014b758)
      [2023/11/18 12:21:55.197] 2:     #5 realm::test_util::unit_test::TestList::ThreadContextImpl::run(realm::test_util::unit_test::TestList::SharedContextImpl::Entry, realm::util::UniqueLock&) unit_test.cpp:727 (realm-sync-tests:arm64+0x100256814)
      [2023/11/18 12:21:55.197] 2:     #6 realm::test_util::unit_test::TestList::ThreadContextImpl::run() unit_test.cpp:681 (realm-sync-tests:arm64+0x100256154)
      [2023/11/18 12:21:55.197] 2:     #7 void* realm::util::Thread::entry_point<realm::test_util::unit_test::TestList::run(realm::test_util::unit_test::TestList::Config)::$_1>(void*) thread.hpp:483 (realm-sync-tests:arm64+0x10025d04c)
      [2023/11/18 12:21:55.197] 2:
      [2023/11/18 12:21:55.197] 2:   Thread T1 (tid=5240673, finished) created by main thread at:
      [2023/11/18 12:21:55.197] 2:     #0 pthread_create <null>:23328284 (libclang_rt.tsan_osx_dynamic.dylib:arm64e+0x2cda0)
      [2023/11/18 12:21:55.197] 2:     #1 realm::test_util::unit_test::TestList::run(realm::test_util::unit_test::TestList::Config) unit_test.cpp:644 (realm-sync-tests:arm64+0x100255660)
      [2023/11/18 12:21:55.197] 2:     #2 test_all(std::__1::shared_ptr<realm::util::Logger> const&) test_all.cpp:579 (realm-sync-tests:arm64+0x100006920)
      [2023/11/18 12:21:55.197] 2:     #3 main main.cpp:26 (realm-sync-tests:arm64+0x100004bd0)
      [2023/11/18 12:21:55.197] 2:
      [2023/11/18 12:21:55.197] 2: SUMMARY: ThreadSanitizer: data race network.cpp:1861 in realm::sync::network::Service::Descriptor::accept(realm::sync::network::Service::Descriptor&, realm::sync::network::StreamProtocol, realm::sync::network::Endpoint*, std::__1::error_code&)
      

      The read is a read of errno and the write is a write to errno. POSIX requires that errno be thread-local, so this is maybe a tsan bug?

            Assignee:
            Unassigned Unassigned
            Reporter:
            thomas.goyne@mongodb.com Thomas Goyne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: