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 data race on iso-stress bot between TypeArguments::IsSubvectorEquivalent and TypeArguments::Canonicalize #47140

Closed
aam opened this issue Sep 7, 2021 · 4 comments
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 Sep 7, 2021

from logs

==================
WARNING: ThreadSanitizer: data race (pid=21973)
  Read of size 8 at 0x7f656edf1098 by thread T13 (mutexes: write M168739214836375688):
    #0 dart::TypeArguments::IsSubvectorEquivalent(dart::TypeArguments const&, long, long, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ??:? (dart+0x217c612)
    #1 dart::Type::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:20925 (dart+0x21ce6b4)
    #2 dart::Type::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:20863 (dart+0x21ce3b8)
    #3 dart::TypeRef::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21658 (dart+0x21d29df)
    #4 dart::TypeParameter::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ??:? (dart+0x21d3842)
    #5 dart::AbstractType::Equals(dart::Instance const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.h:8021 (dart+0x21ec5f0)
    #6 dart::TypeParameter::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/canonical_tables.h:218 (dart+0x21d4cf6)
    #7 <null> ../../out/ReleaseTSANX64/../../runtime/vm/canonical_tables.h:241 (dart+0x21d4cf6)
    #8 <null> ../../out/ReleaseTSANX64/../../runtime/vm/hash_table.h:224 (dart+0x21d4cf6)
    #9 <null> ../../out/ReleaseTSANX64/../../runtime/vm/hash_table.h:774 (dart+0x21d4cf6)
    #10 dart::TypeParameter::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:22122 (dart+0x21d4cf6)
    #11 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7100 (dart+0x215a120)
    #12 dart::Type::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21181 (dart+0x21cfcbb)
    #13 dart::TypeRef::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21711 (dart+0x21d2e7d)
    #14 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7100 (dart+0x215a120)
    #15 dart::ClassFinalizer::FinalizeTypeArguments(dart::Zone*, dart::TypeArguments const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:721 (dart+0x200c070)
    #16 dart::ClassFinalizer::FinalizeTypeParameters(dart::Zone*, dart::Class const&, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:326 (dart+0x200be8a)
    #17 dart::ClassFinalizer::FinalizeSignature(dart::Zone*, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:868 (dart+0x200dcd0)
    #18 dart::ClassFinalizer::FinalizeType(dart::AbstractType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:813 (dart+0x200ce87)
    #19 dart::kernel::TypeTranslator::BuildFunctionType(bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3226 (dart+0x2980b5f)
    #20 dart::kernel::TypeTranslator::BuildTypeInternal() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3074 (dart+0x297f74b)
    #21 dart::kernel::TypeTranslator::BuildType() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3029 (dart+0x29774ca)
    #22 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1364 (dart+0x298b4ce)
    #23 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1316 (dart+0x298b4ce)
    #24 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1277 (dart+0x298ae4a)
    #25 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1016 (dart+0x298a2a8)
    #26 dart::kernel::ScopeBuilder::VisitFunctionNode() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:553 (dart+0x29898e6)
    #27 dart::kernel::ScopeBuilder::VisitNode() ??:? (dart+0x298888c)
    #28 dart::kernel::ScopeBuilder::BuildScopes() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:231 (dart+0x298639e)
    #29 dart::ParsedFunction::EnsureKernelScopes() ../../out/ReleaseTSANX64/../../runtime/vm/parser.cc:133 (dart+0x22368c0)
    #30 dart::kernel::StreamingFlowGraphBuilder::ParseKernelASTFunction() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:1045 (dart+0x292efb5)
    #31 dart::kernel::StreamingFlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:983 (dart+0x292ece9)
    #32 dart::kernel::FlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_to_il.cc:771 (dart+0x294e502)
    #33 dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*>*, long, bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:138 (dart+0x234c6cb)
    #34 dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:541 (dart+0x234e0d2)
    #35 dart::CompileFunctionHelper(dart::CompilationPipeline*, dart::Function const&, bool, long) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:721 (dart+0x234f1ff)
    #36 dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:851 (dart+0x234ec21)
    #37 dart::Function::EnsureHasCode() const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:10174 (dart+0x218fc87)
    #38 dart::DRT_HelperCompileFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:231 (dart+0x234cd6a)
    #39 dart::DRT_CompileFunction(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:211 (dart+0x234cd6a)
    #40 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #41 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x2075eae)
    #42 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x2079d87)
    #43 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x2079d87)
    #44 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1398 (dart+0x20c0525)
    #45 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x210b02e)
    #46 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x210b9df)
    #47 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x210c463)
    #48 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x232b68a)
    #49 dart::DRT_HelperNoSuchMethodFromPrologue(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2659 (dart+0x22db318)
    #50 dart::DRT_NoSuchMethodFromPrologue(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2640 (dart+0x22db318)
    #51 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #52 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x20a5886)
    #53 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x20a5886)
    #54 dart::Exceptions::ReThrow(dart::Thread*, dart::Instance const&, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:917 (dart+0x20a5a59)
    #55 dart::Exceptions::PropagateError(dart::Error const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:934 (dart+0x20a5b30)
    #56 dart::ThrowIfError(dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:440 (dart+0x22db47e)
    #57 dart::DRT_HelperNoSuchMethodFromPrologue(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2661 (dart+0x22db47e)
    #58 dart::DRT_NoSuchMethodFromPrologue(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2640 (dart+0x22db47e)
    #59 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #60 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x2075eae)
    #61 dart::DartEntry::InvokeNoSuchMethod(dart::Thread*, dart::Instance const&, dart::String const&, dart::Array const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x2077116)
    #62 dart::DartEntry::InvokeNoSuchMethod(dart::Thread*, dart::Instance const&, dart::String const&, dart::Array const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:372 (dart+0x2077116)
    #63 dart::DRT_HelperNoSuchMethodFromPrologue(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2659 (dart+0x22db318)
    #64 dart::DRT_NoSuchMethodFromPrologue(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2640 (dart+0x22db318)
    #65 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #66 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x20a5886)
    #67 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x20a5886)
    #68 dart::Exceptions::Throw(dart::Thread*, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:909 (dart+0x20a5065)
    #69 dart::DRT_HelperThrow(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1210 (dart+0x22d6253)
    #70 dart::DRT_Throw(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1208 (dart+0x22d6253)
    #71 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #72 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x20a5886)
    #73 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x20a5886)
    #74 dart::Exceptions::ReThrow(dart::Thread*, dart::Instance const&, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:917 (dart+0x20a5a59)
    #75 dart::Exceptions::PropagateError(dart::Error const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:934 (dart+0x20a5b30)
    #76 dart::DRT_HelperTypeCheck(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1025 (dart+0x22d5ce8)
    #77 dart::DRT_TypeCheck(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:931 (dart+0x22d5ce8)
    #78 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x2075eae)
    #79 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x2075c70)
    #80 dart::ThrowTypeError(dart::TokenPosition, dart::Instance const&, dart::AbstractType const&, dart::String const&) ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:4258 (dart+0x216d04d)
    #81 dart::Function::DoArgumentTypesMatch(dart::Array const&, dart::ArgumentsDescriptor const&, dart::TypeArguments const&, dart::TypeArguments const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:8664 (dart+0x2186bb6)
    #82 dart::Function::DoArgumentTypesMatch(dart::Array const&, dart::ArgumentsDescriptor const&, dart::TypeArguments const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:8575 (dart+0x216e690)
    #83 dart::Function::DoArgumentTypesMatch(dart::Array const&, dart::ArgumentsDescriptor const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:8549 (dart+0x2185c27)
    #84 dart::DRT_HelperTypeCheck(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1023 (dart+0x22d5c4d)
    #85 dart::DRT_TypeCheck(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:931 (dart+0x22d5c4d)
    #86 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #87 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x20a5886)
    #88 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x20a5886)
    #89 dart::Exceptions::Throw(dart::Thread*, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:909 (dart+0x20a5065)
    #90 dart::DRT_HelperThrow(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1210 (dart+0x22d6253)
    #91 dart::DRT_Throw(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1208 (dart+0x22d6253)
    #92 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #93 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x20a5886)
    #94 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x20a5886)
    #95 dart::Exceptions::Throw(dart::Thread*, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:909 (dart+0x20a5065)
    #96 dart::DRT_HelperThrow(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1210 (dart+0x22d6253)
    #97 dart::DRT_Throw(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1208 (dart+0x22d6253)
    #98 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #99 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x2075eae)
    #100 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x2079d87)
    #101 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x2079d87)
    #102 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1398 (dart+0x20c0525)
    #103 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x210b02e)
    #104 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x210b9df)
    #105 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x210c463)
    #106 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x232b68a)
    #107 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x232c125)
    #108 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:153 (dart+0x223500d)

  Previous atomic write of size 8 at 0x7f656edf1098 by thread T7:
    #0 __tsan_atomic64_store ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp:577 (dart+0x1dfdc75)
    #1 void std::__2::__cxx_atomic_store<dart::AbstractTypePtr>(std::__2::__cxx_atomic_base_impl<dart::AbstractTypePtr>*, dart::AbstractTypePtr, std::__2::memory_order) ../../out/ReleaseTSANX64/../../buildtools/linux-x64/clang/bin/../include/c++/v1/atomic:993 (dart+0x21f4acf)
    #2 <null> ../../out/ReleaseTSANX64/../../buildtools/linux-x64/clang/bin/../include/c++/v1/atomic:1607 (dart+0x21f4acf)
    #3 void dart::UntaggedObject::StoreCompressedArrayPointer<dart::AbstractTypePtr, dart::AbstractTypePtr, (std::__2::memory_order)0>(dart::AbstractTypePtr const*, dart::AbstractTypePtr) ../../out/ReleaseTSANX64/../../runtime/vm/raw_object.h:611 (dart+0x21f4acf)
    #4 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/raw_object.h:2470 (dart+0x215a16c)
    #5 <null> ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:6714 (dart+0x215a16c)
    #6 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7106 (dart+0x215a16c)
    #7 dart::Type::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21181 (dart+0x21cfcbb)
    #8 dart::TypeRef::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21711 (dart+0x21d2e7d)
    #9 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7100 (dart+0x215a120)
    #10 dart::ClassFinalizer::FinalizeTypeArguments(dart::Zone*, dart::TypeArguments const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:721 (dart+0x200c070)
    #11 dart::ClassFinalizer::FinalizeTypeParameters(dart::Zone*, dart::Class const&, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:326 (dart+0x200be8a)
    #12 dart::ClassFinalizer::FinalizeSignature(dart::Zone*, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:868 (dart+0x200dcd0)
    #13 dart::ClassFinalizer::FinalizeType(dart::AbstractType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:813 (dart+0x200ce87)
    #14 dart::kernel::TypeTranslator::BuildFunctionType(bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3226 (dart+0x2980b5f)
    #15 dart::kernel::TypeTranslator::BuildTypeInternal() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3074 (dart+0x297f74b)
    #16 dart::kernel::TypeTranslator::BuildType() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3029 (dart+0x29774ca)
    #17 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1364 (dart+0x298b4ce)
    #18 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1316 (dart+0x298b4ce)
    #19 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1277 (dart+0x298ae4a)
    #20 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1016 (dart+0x298a2a8)
    #21 dart::kernel::ScopeBuilder::VisitFunctionNode() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:553 (dart+0x29898e6)
    #22 dart::kernel::ScopeBuilder::VisitNode() ??:? (dart+0x298888c)
    #23 dart::kernel::ScopeBuilder::BuildScopes() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:231 (dart+0x298639e)
    #24 dart::ParsedFunction::EnsureKernelScopes() ../../out/ReleaseTSANX64/../../runtime/vm/parser.cc:133 (dart+0x22368c0)
    #25 dart::kernel::StreamingFlowGraphBuilder::ParseKernelASTFunction() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:1045 (dart+0x292efb5)
    #26 dart::kernel::StreamingFlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:983 (dart+0x292ece9)
    #27 dart::kernel::FlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_to_il.cc:771 (dart+0x294e502)
    #28 dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*>*, long, bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:138 (dart+0x234c6cb)
    #29 dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:541 (dart+0x234e0d2)
    #30 dart::CompileFunctionHelper(dart::CompilationPipeline*, dart::Function const&, bool, long) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:721 (dart+0x234f1ff)
    #31 dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:851 (dart+0x234ec21)
    #32 dart::Function::EnsureHasCode() const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:10174 (dart+0x218fc87)
    #33 dart::DRT_HelperCompileFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:231 (dart+0x234cd6a)
    #34 dart::DRT_CompileFunction(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:211 (dart+0x234cd6a)
    #35 <null> <null> (memfd:dart-codespace (deleted)+0x2542)
    #36 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x2075eae)
    #37 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x2079d87)
    #38 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x2079d87)
    #39 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1398 (dart+0x20c0525)
    #40 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x210b02e)
    #41 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x210b9df)
    #42 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x210c463)
    #43 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x232b68a)
    #44 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x232c125)
    #45 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:153 (dart+0x223500d)

  Location is global '<null>' at 0x000000000000 (memfd:dart-oldspace (deleted)+0x000000071098)

  Mutex M168739214836375688 is already destroyed.

  Thread T13 'DartWorker' (tid=21988, running) created by thread T6 at:
    #0 pthread_create ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:975 (dart+0x1db1b5b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:172 (dart+0x2234e9c)
    #2 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296 (dart+0x232ad1f)
    #3 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:94 (dart+0x232ad1f)
    #4 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46 (dart+0x210ac2a)
    #5 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:121 (dart+0x210ac2a)
    #6 dart::Isolate::Run() ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:2346 (dart+0x20c4c4c)
    #7 Dart_RunLoopAsync ../../out/ReleaseTSANX64/../../runtime/vm/dart_api_impl.cc:2061 (dart+0x29d931a)
    #8 dart::SpawnIsolateTask::Run(dart::Isolate*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:730 (dart+0x1feb2d4)
    #9 dart::SpawnIsolateTask::RunLightweight(char const*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:699 (dart+0x1feada1)
    #10 dart::SpawnIsolateTask::Run() ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:633 (dart+0x1feaac4)
    #11 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x232b68a)
    #12 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x232c125)
    #13 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:153 (dart+0x223500d)

  Thread T7 'DartWorker' (tid=21981, running) created by thread T6 at:
    #0 pthread_create ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:975 (dart+0x1db1b5b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:172 (dart+0x2234e9c)
    #2 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296 (dart+0x232ad1f)
    #3 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:94 (dart+0x232ad1f)
    #4 dart::BootstrapNatives::DN_Isolate_spawnFunction(dart::Thread*, dart::Zone*, dart::NativeArguments*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46 (dart+0x1fe82f1)
    #5 dart::DN_HelperIsolate_spawnFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:976 (dart+0x1fe82f1)
    #6 dart::BootstrapNatives::DN_Isolate_spawnFunction(dart::Thread*, dart::Zone*, dart::NativeArguments*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:910 (dart+0x1fe82f1)
    #7 dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) ../../out/ReleaseTSANX64/../../runtime/vm/native_entry.cc:140 (dart+0x212ccae)
    #8 <null> <null> (memfd:dart-codespace (deleted)+0x2623)
    #9 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x2075eae)
    #10 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x2079d87)
    #11 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x2079d87)
    #12 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1398 (dart+0x20c0525)
    #13 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x210b02e)
    #14 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x210b9df)
    #15 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x210c463)
    #16 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x232b68a)
    #17 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x232c125)
    #18 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:153 (dart+0x223500d)

SUMMARY: ThreadSanitizer: data race ??:? in dart::TypeArguments::IsSubvectorEquivalent(dart::TypeArguments const&, long, long, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const
@aam aam added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening labels Sep 7, 2021
@aam aam changed the title tsan data race on iso-stress bot between TypeArguments::IsSubvectorEquilvaent and TypeArguments::Canonicalize tsan data race on iso-stress bot between TypeArguments::IsSubvectorEquivalent and TypeArguments::Canonicalize Sep 7, 2021
@alexmarkov
Copy link
Contributor

Happened once again:

==================
WARNING: ThreadSanitizer: data race (pid=26323)
  Read of size 8 at 0x7fc0e2a21008 by thread T10 (mutexes: write M443458809285842064):
    #0 dart::TypeArguments::IsSubvectorEquivalent(dart::TypeArguments const&, long, long, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ??:? (dart+0x2205c62)
    #1 dart::Type::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:20843 (dart+0x2251be4)
    #2 dart::Type::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:20781 (dart+0x22518e8)
    #3 dart::TypeRef::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21589 (dart+0x2255e1f)
    #4 dart::TypeParameter::IsEquivalent(dart::Instance const&, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21830 (dart+0x2256dcc)
    #5 dart::AbstractType::Equals(dart::Instance const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.h:8025 (dart+0x226e520)
    #6 dart::TypeParameter::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/canonical_tables.h:218 (dart+0x2257efd)
    #7 <null> ../../out/ReleaseTSANX64/../../runtime/vm/canonical_tables.h:241 (dart+0x2257efd)
    #8 <null> ../../out/ReleaseTSANX64/../../runtime/vm/hash_table.h:224 (dart+0x2257efd)
    #9 <null> ../../out/ReleaseTSANX64/../../runtime/vm/hash_table.h:775 (dart+0x2257efd)
    #10 dart::TypeParameter::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:22030 (dart+0x2257efd)
    #11 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7016 (dart+0x21e4980)
    #12 dart::Type::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21099 (dart+0x22531db)
    #13 dart::TypeRef::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21642 (dart+0x22562bb)
    #14 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7016 (dart+0x21e4980)
    #15 dart::ClassFinalizer::FinalizeTypeArguments(dart::Zone*, dart::TypeArguments const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:722 (dart+0x20f1690)
    #16 dart::ClassFinalizer::FinalizeTypeParameters(dart::Zone*, dart::Class const&, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:327 (dart+0x20f14aa)
    #17 dart::ClassFinalizer::FinalizeSignature(dart::Zone*, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:869 (dart+0x20f3260)
    #18 dart::ClassFinalizer::FinalizeType(dart::AbstractType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:814 (dart+0x20f238e)
    #19 dart::kernel::TypeTranslator::BuildFunctionType(bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3277 (dart+0x29d8132)
    #20 dart::kernel::TypeTranslator::BuildTypeInternal() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3126 (dart+0x29d6c8b)
    #21 dart::kernel::TypeTranslator::BuildType() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3081 (dart+0x29ce54a)
    #22 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1364 (dart+0x29e2a03)
    #23 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1316 (dart+0x29e2a03)
    #24 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1277 (dart+0x29e238a)
    #25 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1016 (dart+0x29e17f8)
    #26 dart::kernel::ScopeBuilder::VisitFunctionNode() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:553 (dart+0x29e0e36)
    #27 dart::kernel::ScopeBuilder::VisitNode() ??:? (dart+0x29dfddc)
    #28 dart::kernel::ScopeBuilder::BuildScopes() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:231 (dart+0x29dd9de)
    #29 dart::ParsedFunction::EnsureKernelScopes() ../../out/ReleaseTSANX64/../../runtime/vm/parser.cc:133 (dart+0x22b82e0)
    #30 dart::kernel::StreamingFlowGraphBuilder::ParseKernelASTFunction() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:1046 (dart+0x2986435)
    #31 dart::kernel::StreamingFlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:984 (dart+0x2986169)
    #32 dart::kernel::FlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_to_il.cc:775 (dart+0x29a4802)
    #33 dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*>*, long, bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:138 (dart+0x23bb56b)
    #34 dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:541 (dart+0x23bcf42)
    #35 dart::CompileFunctionHelper(dart::CompilationPipeline*, dart::Function const&, bool, long) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:721 (dart+0x23be0ac)
    #36 dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:851 (dart+0x23bdae1)
    #37 dart::Function::EnsureHasCode() const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:10085 (dart+0x221894f)
    #38 dart::DRT_HelperCompileFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:231 (dart+0x23bbbfb)
    #39 dart::DRT_CompileFunction(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:211 (dart+0x23bbbfb)
    #40 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #41 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x210da84)
    #42 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x21118e7)
    #43 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x21118e7)
    #44 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1387 (dart+0x2156665)
    #45 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x219c19e)
    #46 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x219cb4f)
    #47 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x219d5b3)
    #48 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x23a0b2a)
    #49 dart::DRT_HelperNoSuchMethodFromPrologue(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2672 (dart+0x2353743)
    #50 dart::DRT_NoSuchMethodFromPrologue(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2653 (dart+0x2353743)
    #51 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #52 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x213bc16)
    #53 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x213bc16)
    #54 dart::Exceptions::ReThrow(dart::Thread*, dart::Instance const&, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:917 (dart+0x213bde9)
    #55 dart::Exceptions::PropagateError(dart::Error const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:934 (dart+0x213bec0)
    #56 dart::ThrowIfError(dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:453 (dart+0x2353899)
    #57 dart::DRT_HelperNoSuchMethodFromPrologue(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2674 (dart+0x2353899)
    #58 dart::DRT_NoSuchMethodFromPrologue(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2653 (dart+0x2353899)
    #59 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #60 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x210da84)
    #61 dart::DartEntry::InvokeNoSuchMethod(dart::Thread*, dart::Instance const&, dart::String const&, dart::Array const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x210ecad)
    #62 dart::DartEntry::InvokeNoSuchMethod(dart::Thread*, dart::Instance const&, dart::String const&, dart::Array const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:372 (dart+0x210ecad)
    #63 dart::DRT_HelperNoSuchMethodFromPrologue(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2672 (dart+0x2353743)
    #64 dart::DRT_NoSuchMethodFromPrologue(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:2653 (dart+0x2353743)
    #65 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #66 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x213bc16)
    #67 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x213bc16)
    #68 dart::Exceptions::Throw(dart::Thread*, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:909 (dart+0x213b3f5)
    #69 dart::DRT_HelperThrow(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1223 (dart+0x234e831)
    #70 dart::DRT_Throw(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1221 (dart+0x234e831)
    #71 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #72 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x213bc16)
    #73 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x213bc16)
    #74 dart::Exceptions::ReThrow(dart::Thread*, dart::Instance const&, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:917 (dart+0x213bde9)
    #75 dart::Exceptions::PropagateError(dart::Error const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:934 (dart+0x213bec0)
    #76 dart::DRT_HelperTypeCheck(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1038 (dart+0x234e38c)
    #77 dart::DRT_TypeCheck(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:944 (dart+0x234e38c)
    #78 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x210da84)
    #79 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x210d860)
    #80 dart::ThrowTypeError(dart::TokenPosition, dart::Instance const&, dart::AbstractType const&, dart::String const&) ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:4175 (dart+0x21f6dad)
    #81 dart::Function::DoArgumentTypesMatch(dart::Array const&, dart::ArgumentsDescriptor const&, dart::TypeArguments const&, dart::TypeArguments const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:8577 (dart+0x220f8e6)
    #82 dart::Function::DoArgumentTypesMatch(dart::Array const&, dart::ArgumentsDescriptor const&, dart::TypeArguments const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:8488 (dart+0x21f83b0)
    #83 dart::Function::DoArgumentTypesMatch(dart::Array const&, dart::ArgumentsDescriptor const&) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:8462 (dart+0x220e957)
    #84 dart::DRT_HelperTypeCheck(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1036 (dart+0x234e2f7)
    #85 dart::DRT_TypeCheck(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:944 (dart+0x234e2f7)
    #86 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #87 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x213bc16)
    #88 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x213bc16)
    #89 dart::Exceptions::Throw(dart::Thread*, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:909 (dart+0x213b3f5)
    #90 dart::DRT_HelperThrow(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1223 (dart+0x234e831)
    #91 dart::DRT_Throw(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1221 (dart+0x234e831)
    #92 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #93 dart::JumpToExceptionHandler(dart::Thread*, unsigned long, unsigned long, unsigned long, dart::Object const&, dart::Object const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:584 (dart+0x213bc16)
    #94 dart::ThrowExceptionHelper(dart::Thread*, dart::Instance const&, dart::Instance const&, bool) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:768 (dart+0x213bc16)
    #95 dart::Exceptions::Throw(dart::Thread*, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/exceptions.cc:909 (dart+0x213b3f5)
    #96 dart::DRT_HelperThrow(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1223 (dart+0x234e831)
    #97 dart::DRT_Throw(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/runtime_entry.cc:1221 (dart+0x234e831)
    #98 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #99 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x210da84)
    #100 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x21118e7)
    #101 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x21118e7)
    #102 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1387 (dart+0x2156665)
    #103 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x219c19e)
    #104 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x219cb4f)
    #105 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x219d5b3)
    #106 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x23a0b2a)
    #107 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x23a15c5)
    #108 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154 (dart+0x22b69fd)

  Previous atomic write of size 8 at 0x7fc0e2a21008 by thread T8:
    #0 void std::__2::__cxx_atomic_store<dart::AbstractTypePtr>(std::__2::__cxx_atomic_base_impl<dart::AbstractTypePtr>*, dart::AbstractTypePtr, std::__2::memory_order) ../../out/ReleaseTSANX64/../../buildtools/linux-x64/clang/bin/../include/c++/v1/atomic:996 (dart+0x22776bf)
    #1 <null> ../../out/ReleaseTSANX64/../../buildtools/linux-x64/clang/bin/../include/c++/v1/atomic:1614 (dart+0x22776bf)
    #2 void dart::UntaggedObject::StoreCompressedArrayPointer<dart::AbstractTypePtr, dart::AbstractTypePtr, (std::__2::memory_order)0>(dart::AbstractTypePtr const*, dart::AbstractTypePtr) ../../out/ReleaseTSANX64/../../runtime/vm/raw_object.h:610 (dart+0x22776bf)
    #3 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/raw_object.h:2467 (dart+0x21e49cc)
    #4 <null> ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:6631 (dart+0x21e49cc)
    #5 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7022 (dart+0x21e49cc)
    #6 dart::Type::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21099 (dart+0x22531db)
    #7 dart::TypeRef::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:21642 (dart+0x22562bb)
    #8 dart::TypeArguments::Canonicalize(dart::Thread*, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:7016 (dart+0x21e4980)
    #9 dart::ClassFinalizer::FinalizeTypeArguments(dart::Zone*, dart::TypeArguments const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:722 (dart+0x20f1690)
    #10 dart::ClassFinalizer::FinalizeTypeParameters(dart::Zone*, dart::Class const&, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:327 (dart+0x20f14aa)
    #11 dart::ClassFinalizer::FinalizeSignature(dart::Zone*, dart::FunctionType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:869 (dart+0x20f3260)
    #12 dart::ClassFinalizer::FinalizeType(dart::AbstractType const&, dart::ClassFinalizer::FinalizationKind, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) ../../out/ReleaseTSANX64/../../runtime/vm/class_finalizer.cc:814 (dart+0x20f238e)
    #13 dart::kernel::TypeTranslator::BuildFunctionType(bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3277 (dart+0x29d8132)
    #14 dart::kernel::TypeTranslator::BuildTypeInternal() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3126 (dart+0x29d6c8b)
    #15 dart::kernel::TypeTranslator::BuildType() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_translation_helper.cc:3081 (dart+0x29ce54a)
    #16 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1364 (dart+0x29e2a03)
    #17 dart::kernel::ScopeBuilder::VisitVariableDeclaration() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1316 (dart+0x29e2a03)
    #18 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1277 (dart+0x29e238a)
    #19 dart::kernel::ScopeBuilder::VisitStatement() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:1016 (dart+0x29e17f8)
    #20 dart::kernel::ScopeBuilder::VisitFunctionNode() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:553 (dart+0x29e0e36)
    #21 dart::kernel::ScopeBuilder::VisitNode() ??:? (dart+0x29dfddc)
    #22 dart::kernel::ScopeBuilder::BuildScopes() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/scope_builder.cc:231 (dart+0x29dd9de)
    #23 dart::ParsedFunction::EnsureKernelScopes() ../../out/ReleaseTSANX64/../../runtime/vm/parser.cc:133 (dart+0x22b82e0)
    #24 dart::kernel::StreamingFlowGraphBuilder::ParseKernelASTFunction() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:1046 (dart+0x2986435)
    #25 dart::kernel::StreamingFlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc:984 (dart+0x2986169)
    #26 dart::kernel::FlowGraphBuilder::BuildGraph() ../../out/ReleaseTSANX64/../../runtime/vm/compiler/frontend/kernel_to_il.cc:775 (dart+0x29a4802)
    #27 dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*>*, long, bool) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:138 (dart+0x23bb56b)
    #28 dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:541 (dart+0x23bcf42)
    #29 dart::CompileFunctionHelper(dart::CompilationPipeline*, dart::Function const&, bool, long) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:721 (dart+0x23be0ac)
    #30 dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:851 (dart+0x23bdae1)
    #31 dart::Function::EnsureHasCode() const ../../out/ReleaseTSANX64/../../runtime/vm/object.cc:10085 (dart+0x221894f)
    #32 dart::DRT_HelperCompileFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:231 (dart+0x23bbbfb)
    #33 dart::DRT_CompileFunction(dart::NativeArguments) ../../out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:211 (dart+0x23bbbfb)
    #34 <null> <null> (memfd:dart-codespace (deleted)+0x2562)
    #35 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x210da84)
    #36 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x21118e7)
    #37 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x21118e7)
    #38 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1387 (dart+0x2156665)
    #39 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x219c19e)
    #40 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x219cb4f)
    #41 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x219d5b3)
    #42 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x23a0b2a)
    #43 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x23a15c5)
    #44 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154 (dart+0x22b69fd)

  Location is global '<null>' at 0x000000000000 (memfd:dart-oldspace (deleted)+0x21008)

  Mutex M443458809285842064 is already destroyed.

  Thread T10 'DartWorker' (tid=26335, running) created by thread T6 at:
    #0 pthread_create ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1001 (dart+0x1e4355d)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:173 (dart+0x22b688c)
    #2 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296 (dart+0x23a01bf)
    #3 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:94 (dart+0x23a01bf)
    #4 dart::BootstrapNatives::DN_Isolate_spawnFunction(dart::Thread*, dart::Zone*, dart::NativeArguments*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46 (dart+0x2080370)
    #5 dart::DN_HelperIsolate_spawnFunction(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:988 (dart+0x2080370)
    #6 dart::BootstrapNatives::DN_Isolate_spawnFunction(dart::Thread*, dart::Zone*, dart::NativeArguments*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:922 (dart+0x2080370)
    #7 dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) ../../out/ReleaseTSANX64/../../runtime/vm/native_entry.cc:140 (dart+0x21bde2e)
    #8 <null> <null> (memfd:dart-codespace (deleted)+0x2643)
    #9 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (dart+0x210da84)
    #10 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (dart+0x21118e7)
    #11 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:757 (dart+0x21118e7)
    #12 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1387 (dart+0x2156665)
    #13 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:240 (dart+0x219c19e)
    #14 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:450 (dart+0x219cb4f)
    #15 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (dart+0x219d5b3)
    #16 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x23a0b2a)
    #17 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x23a15c5)
    #18 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154 (dart+0x22b69fd)

  Thread T8 'DartWorker' (tid=26332, running) created by thread T7 at:
    #0 pthread_create ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1001 (dart+0x1e4355d)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:173 (dart+0x22b688c)
    #2 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296 (dart+0x23a01bf)
    #3 dart::ThreadPool::RunImpl(std::__2::unique_ptr<dart::ThreadPool::Task, std::__2::default_delete<dart::ThreadPool::Task> >) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:94 (dart+0x23a01bf)
    #4 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46 (dart+0x219bd9a)
    #5 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:121 (dart+0x219bd9a)
    #6 dart::Isolate::Run() ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:2339 (dart+0x215ac0c)
    #7 Dart_RunLoopAsync ../../out/ReleaseTSANX64/../../runtime/vm/dart_api_impl.cc:2069 (dart+0x2a2bf1f)
    #8 dart::SpawnIsolateTask::Run(dart::Isolate*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:742 (dart+0x20833c4)
    #9 dart::SpawnIsolateTask::RunLightweight(char const*) ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:711 (dart+0x2082e91)
    #10 dart::SpawnIsolateTask::Run() ../../out/ReleaseTSANX64/../../runtime/lib/isolate.cc:645 (dart+0x2082bb4)
    #11 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (dart+0x23a0b2a)
    #12 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (dart+0x23a15c5)
    #13 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154 (dart+0x22b69fd)

SUMMARY: ThreadSanitizer: data race ??:? in dart::TypeArguments::IsSubvectorEquivalent(dart::TypeArguments const&, long, long, dart::TypeEquality, dart::ZoneGrowableHandlePtrArray<dart::AbstractType const>*) const
==================

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8832314894438510465/+/u/Run_Isolate_Stress_Tests_shard_3/task_stdout_stderr:_Run_Isolate_Stress_Tests_shard_3

@mkustermann
Copy link
Member

Looking at the code, the race seems to be

bool TypeArguments::IsSubvectorEquivalent(...) {                                                 
  ...
  for (intptr_t i = from_index; i < from_index + len; i++) {                                                      
    type = IsNull() ? Type::DynamicType() : TypeAt(i);  // <-- reads type at i
    ...
  }
  ...
}

races with

TypeArgumentsPtr TypeArguments::Canonicalize(...) {
  ...
  {   
    SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
    ...
    result ^= table.GetOrNull(CanonicalTypeArgumentsKey(*this));
  }
  if (result.IsNull()) {
    // Canonicalize each type argument.
    AbstractType& type_arg = AbstractType::Handle(zone);
    for (intptr_t i = 0; i < num_types; i++) {
      type_arg = TypeAt(i);
      type_arg = type_arg.Canonicalize(thread, trail);
      SetTypeAt(i, type_arg);  // <-- writes type i
    }
    ...
    SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex());
    ...
}

Maybe we could split this into a Canonicalize() and CanonicalizeLocked() where the former has fast case + slow case with lock + call to ladder which may do recursive canonicalization.

/cc @aam Interested in looking at this?

@aam
Copy link
Contributor Author

aam commented Mar 17, 2022

Maybe we could split this into a Canonicalize() and CanonicalizeLocked() where the former has fast case + slow case with lock + call to ladder which may do recursive canonicalization.

Immediate complication seems to be that there is indirect recursion: TypeArguments::Canonicalize calls various Type::Canonicalize, which in turn call TypeArguments::Canonicalize. So concept of CanonicalizeLocked has to be carried through those Canonicalize methods.

@aam
Copy link
Contributor Author

aam commented Mar 17, 2022

Perhaps we should aggregate all canonicalized types in TypeArguments first, then have all SetTypeAt(i, type_arg); done under SafepointMutexLocker ml(isolate_group->type_canonicalization_mutex()); if canonical type arguments is still null few lines below.
That way changes to TypeArguments won't be visible until it goes into the canonical_type_arguments table.

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

3 participants