Skip to content
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

tsan iso-stress-linux data race SetTypeTestingStub/RecordType::ToNullability #54123

Closed
aam opened this issue Nov 21, 2023 · 4 comments
Closed
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening

Comments

@aam
Copy link
Contributor

aam commented Nov 21, 2023

from tsan iso-stress-linux logs

==================
WARNING: ThreadSanitizer: data race (pid=3638)
  Atomic write of size 8 at 0x7f03159d3888 by thread T17:
    #0 bool std::_LIBCPP_ABI_NAMESPACE::__cxx_atomic_compare_exchange_strong[abi:v15000]<unsigned long>(std::_LIBCPP_ABI_NAMESPACE::__cxx_atomic_base_impl<unsigned long>*, unsigned long*, unsigned long, std::_LIBCPP_ABI_NAMESPACE::memory_order, std::_LIBCPP_ABI_NAMESPACE::memory_order) out/ReleaseTSANX64/../../third_party/libcxx/include/atomic:987:12 (dart+0x25be72c)
    #1 std::_LIBCPP_ABI_NAMESPACE::__atomic_base<unsigned long, false>::compare_exchange_strong[abi:v15000](unsigned long&, unsigned long, std::_LIBCPP_ABI_NAMESPACE::memory_order) out/ReleaseTSANX64/../../third_party/libcxx/include/atomic:1634:17 (dart+0x25be72c)
    #2 dart::AbstractType::SetTypeTestingStub(dart::Code const&) const out/ReleaseTSANX64/../../runtime/vm/object.cc:21776:46 (dart+0x25be72c)
    #3 dart::DRT_HelperTypeCheck(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1301:14 (dart+0x26b34fa)
    #4 dart::DRT_TypeCheck(dart::NativeArguments) out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1139:1 (dart+0x26b34fa)
    #5 <null> <null> (memfd:dart-code (deleted)+0x2a69)
    #6 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37:10 (dart+0x24a0db1)
    #7 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:718:28 (dart+0x24a0db1)
    #8 dart::IsolateMessageHandler::HandleMessage(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::Message, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::Message>>) out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1393:15 (dart+0x24d6aa0)
    #9 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:238:16 (dart+0x251761f)
    #10 dart::MessageHandler::TaskCallback() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:457:18 (dart+0x2518254)
    #11 dart::MessageHandlerTask::Run() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31:15 (dart+0x25187c3)
    #12 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158:15 (dart+0x270eac9)
    #13 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:330:9 (dart+0x270efe7)
    #14 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (dart+0x26314e3)

  Previous read of size 8 at 0x7f03159d3888 by thread T10:
    #0 __tsan_memmove ../llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_memintrinsics.cpp:40:3 (dart+0x211bb9b)
    #1 dart::Object::Clone(dart::Object const&, dart::Heap::Space, bool) out/ReleaseTSANX64/../../runtime/vm/object.cc:2993:5 (dart+0x2559f41)
    #2 dart::RecordType::ToNullability(dart::Nullability, dart::Heap::Space) const out/ReleaseTSANX64/../../runtime/vm/object.cc:27567:11 (dart+0x25bbbc7)
    #3 dart::AbstractType::SetInstantiatedNullability(dart::TypeParameter const&, dart::Heap::Space) const out/ReleaseTSANX64/../../runtime/vm/object.cc:21069:36 (dart+0x25bb868)
    #4 dart::TypeParameter::InstantiateFrom(dart::TypeArguments const&, dart::TypeArguments const&, long, dart::Heap::Space, dart::FunctionTypeMapping*, long) const out/ReleaseTSANX64/../../runtime/vm/object.cc:22885:19 (dart+0x25c396c)
    #5 dart::Instance::RuntimeTypeIsSubtypeOf(dart::AbstractType const&, dart::TypeArguments const&, dart::TypeArguments const&) const out/ReleaseTSANX64/../../runtime/vm/object.cc:20696:34 (dart+0x256ca0a)
    #6 dart::Instance::IsAssignableTo(dart::AbstractType const&, dart::TypeArguments const&, dart::TypeArguments const&) const out/ReleaseTSANX64/../../runtime/vm/object.cc:20570:10 (dart+0x25b9730)
    #7 dart::DRT_HelperTypeCheck(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1184:44 (dart+0x26b3425)
    #8 dart::DRT_TypeCheck(dart::NativeArguments) out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1139:1 (dart+0x26b3425)
    #9 <null> <null> (memfd:dart-code (deleted)+0x2a69)
    #10 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37:10 (dart+0x24a0db1)
    #11 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:718:28 (dart+0x24a0db1)
    #12 dart::IsolateMessageHandler::HandleMessage(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::Message, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::Message>>) out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1393:15 (dart+0x24d6aa0)
    #13 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:238:16 (dart+0x251761f)
    #14 dart::MessageHandler::TaskCallback() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:457:18 (dart+0x2518254)
    #15 dart::MessageHandlerTask::Run() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31:15 (dart+0x25187c3)
    #16 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158:15 (dart+0x270eac9)
    #17 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:330:9 (dart+0x270efe7)
    #18 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (dart+0x26314e3)

  Thread T17 'DartWorker' (tid=3657, running) created by thread T15 at:
    #0 pthread_create ../llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1020:3 (dart+0x211fe3b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:173:12 (dart+0x26313a3)
    #2 dart::ThreadPool::Worker::StartThread() out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296:16 (dart+0x270e211)
    #3 dart::ThreadPool::RunImpl(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::ThreadPool::Task, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::ThreadPool::Task>>) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:94:17 (dart+0x270e211)
    #4 bool dart::ThreadPool::Run<dart::SpawnIsolateTask, dart::Isolate*&, std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::IsolateSpawnState, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::IsolateSpawnState>>>(dart::Isolate*&, std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::IsolateSpawnState, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::IsolateSpawnState>>&&) out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46:12 (dart+0x23fe097)
    #5 dart::DN_HelperIsolate_spawnFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments*) out/ReleaseTSANX64/../../runtime/lib/isolate.cc:966:36 (dart+0x23fe097)
    #6 dart::BootstrapNatives::DN_Isolate_spawnFunction(dart::Thread*, dart::Zone*, dart::NativeArguments*) out/ReleaseTSANX64/../../runtime/lib/isolate.cc:913:1 (dart+0x23fe097)
    #7 dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) out/ReleaseTSANX64/../../runtime/vm/native_entry.cc:144:37 (dart+0x25329c4)
    #8 <null> <null> (memfd:dart-code (deleted)+0x2bda)
    #9 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37:10 (dart+0x24a0db1)
    #10 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:718:28 (dart+0x24a0db1)
    #11 dart::IsolateMessageHandler::HandleMessage(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::Message, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::Message>>) out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1393:15 (dart+0x24d6aa0)
    #12 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:238:16 (dart+0x251761f)
    #13 dart::MessageHandler::TaskCallback() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:457:18 (dart+0x2518254)
    #14 dart::MessageHandlerTask::Run() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31:15 (dart+0x25187c3)
    #15 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158:15 (dart+0x270eac9)
    #16 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:330:9 (dart+0x270efe7)
    #17 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (dart+0x26314e3)

  Thread T10 'DartWorker' (tid=3650, running) created by thread T9 at:
    #0 pthread_create ../llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1020:3 (dart+0x211fe3b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:173:12 (dart+0x26313a3)
    #2 dart::ThreadPool::Worker::StartThread() out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296:16 (dart+0x270e211)
    #3 dart::ThreadPool::RunImpl(std::_LIBCPP_ABI_NAMESPACE::unique_ptr<dart::ThreadPool::Task, std::_LIBCPP_ABI_NAMESPACE::default_delete<dart::ThreadPool::Task>>) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:94:17 (dart+0x270e211)
    #4 bool dart::ThreadPool::Run<dart::MessageHandlerTask, dart::MessageHandler*>(dart::MessageHandler*&&) out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46:12 (dart+0x2517096)
    #5 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:119:24 (dart+0x2517096)
    #6 dart::Isolate::Run() out/ReleaseTSANX64/../../runtime/vm/isolate.cc:2333:22 (dart+0x24da37c)
    #7 Dart_RunLoopAsync out/ReleaseTSANX64/../../runtime/vm/dart_api_impl.cc:2105:12 (dart+0x2aa093d)
    #8 dart::SpawnIsolateTask::Run(dart::Isolate*) out/ReleaseTSANX64/../../runtime/lib/isolate.cc:747:10 (dart+0x240197d)
    #9 dart::SpawnIsolateTask::RunLightweight(char const*) out/ReleaseTSANX64/../../runtime/lib/isolate.cc:712:5 (dart+0x24013d4)
    #10 dart::SpawnIsolateTask::Run() out/ReleaseTSANX64/../../runtime/lib/isolate.cc:645:7 (dart+0x24010ec)
    #11 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158:15 (dart+0x270eac9)
    #12 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:330:9 (dart+0x270efe7)
    #13 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (dart+0x26314e3)

SUMMARY: ThreadSanitizer: data race out/ReleaseTSANX64/../../third_party/libcxx/include/atomic:987:12 in bool std::_LIBCPP_ABI_NAMESPACE::__cxx_atomic_compare_exchange_strong[abi:v15000]<unsigned long>(std::_LIBCPP_ABI_NAMESPACE::__cxx_atomic_base_impl<unsigned long>*, unsigned long*, unsigned long, std::_LIBCPP_ABI_NAMESPACE::memory_order, std::_LIBCPP_ABI_NAMESPACE::memory_order)
==================
=> Running "out/ReleaseTSANX64/dart --disable-dart-dev -Drepeat=4 -Dshard=63 -Dshards=200 --sound-null-safety runtime/tests/concurrency/generated_stress_test.dart.jit.dill" failed with -6

@aam aam added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening labels Nov 21, 2023
@aam
Copy link
Contributor Author

aam commented Dec 8, 2023

https://dart-review.googlesource.com/c/sdk/+/340288 with proposed fix

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. gardening
Projects
None yet
Development

No branches or pull requests

1 participant