Skip to content

Data race between stub code initialization and profiler sample processor #54226

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

Closed
rmacnak-google opened this issue Dec 4, 2023 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@rmacnak-google
Copy link
Contributor

WARNING: ThreadSanitizer: data race (pid=49180)
  Read of size 8 at 0x56288dba1330 by thread T3 (mutexes: write M0, write M1):
    #0 dart::StubCode::AsyncExceptionHandler() /b/f/w/out/ReleaseTSANX64/../../runtime/vm/stub_code.h:62:3 (gen_snapshot+0x7a1d94)
    #1 dart::Thread::InitVMConstants() /b/f/w/out/ReleaseTSANX64/../../runtime/vm/thread.cc:194:3 (gen_snapshot+0x7a1d94)
    #2 dart::Thread::Thread(bool) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/thread.cc:129:5 (gen_snapshot+0x7a17c8)
    #3 dart::ThreadRegistry::GetFromFreelistLocked(bool) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/thread_registry.cc:141:18 (gen_snapshot+0x7ad008)
    #4 dart::ThreadRegistry::GetFreeThreadLocked(bool) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/thread_registry.cc:30:20 (gen_snapshot+0x7ad008)
    #5 dart::Thread::AddActiveThread(dart::IsolateGroup*, dart::Isolate*, bool, bool) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/thread.cc:607:37 (gen_snapshot+0x7a57c1)
    #6 dart::Thread::EnterIsolateGroupAsHelper(dart::IsolateGroup*, dart::Thread::TaskKind, bool) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/thread.cc:479:20 (gen_snapshot+0x7a61a9)
    #7 dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0::operator()(dart::IsolateGroup*) const /b/f/w/out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1899:7 (gen_snapshot+0x6d3a72)
    #8 decltype(std::declval<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0&>()(std::declval<dart::IsolateGroup*>())) std::_LIBCPP_ABI_NAMESPACE::__invoke[abi:v15000]<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0&, dart::IsolateGroup*>(dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0&, dart::IsolateGroup*&&) /b/f/w/out/ReleaseTSANX64/../../third_party/libcxx/include/__functional/invoke.h:403:23 (gen_snapshot+0x6d3a72)
    #9 void std::_LIBCPP_ABI_NAMESPACE::__invoke_void_return_wrapper<void, true>::__call<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0&, dart::IsolateGroup*>(dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0&, dart::IsolateGroup*&&) /b/f/w/out/ReleaseTSANX64/../../third_party/libcxx/include/__functional/invoke.h:488:9 (gen_snapshot+0x6d3a72)
    #10 std::_LIBCPP_ABI_NAMESPACE::__function::__alloc_func<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0, std::_LIBCPP_ABI_NAMESPACE::allocator<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0>, void (dart::IsolateGroup*)>::operator()[abi:v15000](dart::IsolateGroup*&&) /b/f/w/out/ReleaseTSANX64/../../third_party/libcxx/include/__functional/function.h:185:16 (gen_snapshot+0x6d3a72)
    #11 std::_LIBCPP_ABI_NAMESPACE::__function::__func<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0, std::_LIBCPP_ABI_NAMESPACE::allocator<dart::SampleBlockProcessor::ThreadMain(unsigned long)::$_0>, void (dart::IsolateGroup*)>::operator()(dart::IsolateGroup*&&) /b/f/w/out/ReleaseTSANX64/../../third_party/libcxx/include/__functional/function.h:359:12 (gen_snapshot+0x6d3a72)
    #12 std::_LIBCPP_ABI_NAMESPACE::__function::__value_func<void (dart::IsolateGroup*)>::operator()[abi:v15000](dart::IsolateGroup*&&) const /b/f/w/out/ReleaseTSANX64/../../third_party/libcxx/include/__functional/function.h:512:16 (gen_snapshot+0x567393)
    #13 std::_LIBCPP_ABI_NAMESPACE::function<void (dart::IsolateGroup*)>::operator()(dart::IsolateGroup*) const /b/f/w/out/ReleaseTSANX64/../../third_party/libcxx/include/__functional/function.h:1187:12 (gen_snapshot+0x567393)
    #14 dart::IsolateGroup::ForEach(std::_LIBCPP_ABI_NAMESPACE::function<void (dart::IsolateGroup*)>) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/isolate.cc:673:5 (gen_snapshot+0x567393)
    #15 dart::SampleBlockProcessor::ThreadMain(unsigned long) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1897:5 (gen_snapshot+0x6d290c)
    #16 dart::ThreadStart(void*) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (gen_snapshot+0x6c93c3)

  Previous write of size 8 at 0x56288dba1330 by main thread:
    #0 dart::StubCode::Init() /b/f/w/out/ReleaseTSANX64/../../runtime/vm/stub_code.cc:51:22 (gen_snapshot+0x792244)
    #1 dart::Dart::DartInit(Dart_InitializeParams const*) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/dart.cc:465:7 (gen_snapshot+0x510d0d)
    #2 dart::Dart::Init(Dart_InitializeParams const*) /b/f/w/out/ReleaseTSANX64/../../runtime/vm/dart.cc:533:18 (gen_snapshot+0x51117b)
    #3 Dart_Initialize /b/f/w/out/ReleaseTSANX64/../../runtime/vm/dart_api_impl.cc:1190:10 (gen_snapshot+0xb8404b)
    #4 dart::bin::main(int, char**) /b/f/w/out/ReleaseTSANX64/../../runtime/bin/gen_snapshot.cc:947:11 (gen_snapshot+0x40968d)
    #5 main /b/f/w/out/ReleaseTSANX64/../../runtime/bin/gen_snapshot.cc:972:10 (gen_snapshot+0x40ab70)

  Location is global 'dart::StubCode::entries_' of size 5280 at 0x56288db9ff10 (gen_snapshot+0xc22330)

log

@rmacnak-google rmacnak-google added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Dec 4, 2023
@rmacnak-google
Copy link
Contributor Author

copybara-service bot pushed a commit that referenced this issue Dec 5, 2023
…tialization.

TEST=tsan
Bug: #54226
Change-Id: I54ce983acae28474c4a31200922b902dd19cf95d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339643
Reviewed-by: Ben Konyi <[email protected]>
Commit-Queue: Ryan Macnak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

1 participant