Skip to content

TSAN: data race on library map #59626

@rmacnak-google

Description

@rmacnak-google
WARNING: ThreadSanitizer: data race (pid=495479)
  Write of size 8 at 0x727000002ba8 by main thread:
    #0 dart::ObjectStore::set_libraries_map(dart::Array const&) out/ReleaseTSANX64/../../runtime/vm/object_store.h:512:3 (dart+0x27a30a1)
    #1 dart::Library::Register(dart::Thread*) const out/ReleaseTSANX64/../../runtime/vm/object.cc:15090:17 (dart+0x27a30a1)
    #2 dart::kernel::KernelLoader::LookupLibrary(dart::kernel::NameIndex) out/ReleaseTSANX64/../../runtime/vm/kernel_loader.cc:2185:12 (dart+0x274ee0c)
    #3 dart::kernel::KernelLoader::LoadLibrary(long) out/ReleaseTSANX64/../../runtime/vm/kernel_loader.cc:827:26 (dart+0x27526e5)
    #4 dart::kernel::KernelLoader::LoadProgram(bool) out/ReleaseTSANX64/../../runtime/vm/kernel_loader.cc:533:7 (dart+0x2750faa)
    #5 dart::kernel::KernelLoader::LoadEntireProgram(dart::kernel::Program*, bool) out/ReleaseTSANX64/../../runtime/vm/kernel_loader.cc:263:34 (dart+0x27502b6)
    #6 Dart_LoadScriptFromKernel out/ReleaseTSANX64/../../runtime/vm/dart_api_impl.cc:5420:23 (dart+0x2cbbc1d)
    #7 dart::bin::IsolateSetupHelper(_Dart_Isolate*, bool, char const*, char const*, bool, Dart_IsolateFlags*, char**, int*) out/ReleaseTSANX64/../../runtime/bin/main_impl.cc:330:14 (dart+0x23799e7)
    #8 dart::bin::CreateIsolateGroupAndSetupHelper(bool, char const*, char const*, char const*, Dart_IsolateFlags*, void*, char**, int*) out/ReleaseTSANX64/../../runtime/bin/main_impl.cc:826:23 (dart+0x2377573)
    #9 dart::bin::RunMainIsolate(char const*, char const*, dart::bin::CommandLineOptions*) out/ReleaseTSANX64/../../runtime/bin/main_impl.cc:1025:26 (dart+0x2376df3)
    #10 dart::bin::main(int, char**) out/ReleaseTSANX64/../../runtime/bin/main_impl.cc:1442:7 (dart+0x2378303)
    #11 main out/ReleaseTSANX64/../../runtime/bin/main.cc:9:3 (dart+0x2376cb4)

  Previous read of size 8 at 0x727000002ba8 by thread T4:
    #0 dart::ObjectStore::libraries_map() const out/ReleaseTSANX64/../../runtime/vm/object_store.h:512:3 (dart+0x27a222c)
    #1 dart::Library::LookupLibrary(dart::Thread*, dart::String const&) out/ReleaseTSANX64/../../runtime/vm/object.cc:14943:21 (dart+0x27a222c)
    #2 dart::MethodRecognizer::ResultCidFromPragma(dart::Object const&) out/ReleaseTSANX64/../../runtime/vm/compiler/method_recognizer.cc:55:47 (dart+0x2bfeaaf)
    #3 dart::StaticCallInstr::ComputeType() const out/ReleaseTSANX64/../../runtime/vm/compiler/backend/type_propagator.cc:1581:26 (dart+0x2b3aea1)
    #4 dart::Definition::Type() out/ReleaseTSANX64/../../runtime/vm/compiler/backend/il.h:2521:35 (dart+0x2a3448c)
    #5 dart::Definition::ReplaceUsesWith(dart::Definition*) out/ReleaseTSANX64/../../runtime/vm/compiler/backend/il.cc:1509:42 (dart+0x2a3448c)
    #6 dart::Definition::ReplaceWithResult(dart::Instruction*, dart::Definition*, dart::ForwardInstructionIterator*) out/ReleaseTSANX64/../../runtime/vm/compiler/backend/il.cc:1650:3 (dart+0x2a35d85)
    #7 dart::Definition::ReplaceWith(dart::Definition*, dart::ForwardInstructionIterator*) out/ReleaseTSANX64/../../runtime/vm/compiler/backend/il.cc:1674:3 (dart+0x2a35efc)
    #8 dart::JitCallSpecializer::ReplaceWithStaticCall(dart::InstanceCallInstr*, dart::Function const&, long) out/ReleaseTSANX64/../../runtime/vm/compiler/jit/jit_call_specializer.cc:60:10 (dart+0x2bfd540)
    #9 dart::JitCallSpecializer::VisitInstanceCall(dart::InstanceCallInstr*) out/ReleaseTSANX64/../../runtime/vm/compiler/jit/jit_call_specializer.cc (dart+0x2bfd86f)
    #10 dart::InstanceCallInstr::Accept(dart::InstructionVisitor*) out/ReleaseTSANX64/../../runtime/vm/compiler/backend/il.cc:1273:1 (dart+0x2a3159c)
    #11 dart::FlowGraphVisitor::VisitBlocks() out/ReleaseTSANX64/../../runtime/vm/compiler/backend/il.cc:1389:21 (dart+0x2a33de4)
    #12 dart::CallSpecializer::ApplyICData() out/ReleaseTSANX64/../../runtime/vm/compiler/call_specializer.cc:53:3 (dart+0x2b3e765)
    #13 dart::CompilerPass_ApplyICData::DoBody(dart::CompilerPassState*) const out/ReleaseTSANX64/../../runtime/vm/compiler/compiler_pass.cc:389:1 (dart+0x2b5c8f9)
    #14 dart::CompilerPass::Run(dart::CompilerPassState*) const out/ReleaseTSANX64/../../runtime/vm/compiler/compiler_pass.cc:230:18 (dart+0x2b5bdd2)
    #15 dart::CompilerPass::RunPipeline(dart::CompilerPass::PipelineMode, dart::CompilerPassState*, bool) out/ReleaseTSANX64/../../runtime/vm/compiler/compiler_pass.cc:310:3 (dart+0x2b5c2ea)
    #16 dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:574:22 (dart+0x291ea78)
    #17 dart::CompileFunctionHelper(dart::CompilationPipeline*, dart::Function const&, bool, long) out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:719:46 (dart+0x291f7d3)
    #18 dart::Compiler::CompileOptimizedFunction(dart::Thread*, dart::Function const&, long) out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:904:10 (dart+0x29202ff)
    #19 dart::BackgroundCompiler::Run() out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:1144:7 (dart+0x2920e4e)
    #20 dart::BackgroundCompilerTask::Run() out/ReleaseTSANX64/../../runtime/vm/compiler/jit/compiler.cc:1104:46 (dart+0x2921da3)
    #21 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:203:15 (dart+0x29043be)
    #22 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:363:9 (dart+0x290491a)
    #23 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:97:5 (dart+0x28757e6)

log

The library map should probably be guarded by the program lock.

Metadata

Metadata

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.gardeningtriagedIssue has been triaged by sub team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions