Skip to content

TSAN detected race in profiler #44089

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
mkustermann opened this issue Nov 6, 2020 · 2 comments
Closed

TSAN detected race in profiler #44089

mkustermann opened this issue Nov 6, 2020 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening

Comments

@mkustermann
Copy link
Member

From this log:

/=====================================================================\
| vm/cc/Profiler_GetSourceReport broke (Pass -> Crash, expected Pass) |
\=====================================================================/

--- Command "run_vm_unittest" (took 35.000785s):
DART_CONFIGURATION=ReleaseTSANX64 out/ReleaseTSANX64/run_vm_tests --dfe=/b/s/w/ir/cache/builder/sdk/out/ReleaseTSANX64/gen/kernel-service.dart.snapshot --ignore-unrecognized-flags Profiler_GetSourceReport

exit code:
-6

stdout:
Running test: Profiler_GetSourceReport
Done: Profiler_GetSourceReport

stderr:
/usr/bin/addr2line: '/memfd:dart-codespace (deleted)': No such file
==15872==WARNING: Can't read from symbolizer at fd 9
/usr/bin/addr2line: '/memfd:dart-codespace (deleted)': No such file
==15872==WARNING: Can't read from symbolizer at fd 9
/usr/bin/addr2line: '/memfd:dart-codespace (deleted)': No such file
==15872==WARNING: Can't read from symbolizer at fd 9
/usr/bin/addr2line: '/memfd:dart-codespace (deleted)': No such file
==15872==WARNING: Can't read from symbolizer at fd 9
==15872==WARNING: Failed to use and restart external symbolizer!
/usr/bin/addr2line: '/memfd:dart-codespace (deleted)': No such file
==================
WARNING: ThreadSanitizer: data race (pid=15872)
  Read of size 8 at 0x7f4547319fd8 by main thread:
    #0 dart::Sample::head_sample() const ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:367 (run_vm_tests+0x3b949a3)
    #1 dart::SampleBuffer::VisitSamples(dart::SampleVisitor*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:637 (run_vm_tests+0x3b949a3)
    #2 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2340 (run_vm_tests+0x3b949a3)
    #3 dart::Dart_TestProfiler_GetSourceReport() ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2305 (run_vm_tests+0x3b949a3)
    #4 dart::TestCase::Run() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:52 (run_vm_tests+0x3a477ec)
    #5 dart::TestCaseBase::RunTest() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:64 (run_vm_tests+0x3a479c1)
    #6 dart::TestCaseBase::RunAll() ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:86 (run_vm_tests+0x3be8508)
    #7 dart::Main(int, char const**) ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:394 (run_vm_tests+0x3a484d3)
    #8 main ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:425 (run_vm_tests+0x3a47d3e)

  Previous write of size 8 at 0x7f4547319fd8 by thread T4:
    #0 memset ../recipe_cleanup/clangshYTOG/llvm_build_dir/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:784 (run_vm_tests+0x39e0e59)
    #1 dart::Sample::Clear() ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:211 (run_vm_tests+0x40b7556)
    #2 dart::Sample::Init(long, long, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:191 (run_vm_tests+0x40b7556)
    #3 dart::SetupSample(dart::Thread*, dart::SampleBuffer*, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.cc:985 (run_vm_tests+0x40b7556)
    #4 dart::Profiler::SampleThread(dart::Thread*, dart::InterruptedThreadState const&) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1362 (run_vm_tests+0x40b7556)
    #5 dart::ThreadInterrupterLinux::ThreadInterruptSignalHandler(int, siginfo_t*, void*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_interrupter_linux.cc:47 (run_vm_tests+0x41a0c57)
    #6 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) ../recipe_cleanup/clangshYTOG/llvm_build_dir/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1907 (run_vm_tests+0x39ddd2f)
    #7 StackResource ../../out/ReleaseTSANX64/../../runtime/vm/allocation.h:25 (run_vm_tests+0x3fc7c66)
    #8 ThreadStackResource ../../out/ReleaseTSANX64/../../runtime/vm/thread_stack_resource.h:21 (run_vm_tests+0x3fc7c66)
    #9 TransitionSafepointState ../../out/ReleaseTSANX64/../../runtime/vm/heap/safepoint.h:162 (run_vm_tests+0x3fc7c66)
    #10 TransitionGeneratedToVM ../../out/ReleaseTSANX64/../../runtime/vm/heap/safepoint.h:181 (run_vm_tests+0x3fc7c66)
    #11 dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) ../../out/ReleaseTSANX64/../../runtime/vm/native_entry.cc:135 (run_vm_tests+0x3fc7c66)
    #12 <null> <null> (memfd:dart-codespace (deleted)+0x22f3)
    #13 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (run_vm_tests+0x3f20ab2)
    #14 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (run_vm_tests+0x3f24b5f)
    #15 dart::DartLibraryCalls::HandleMessage(dart::Object const&, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:792 (run_vm_tests+0x3f24b5f)
    #16 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1379 (run_vm_tests+0x3f7ac5a)
    #17 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:233 (run_vm_tests+0x3fc50a0)
    #18 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:443 (run_vm_tests+0x3fc5aa4)
    #19 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (run_vm_tests+0x3fc6493)
    #20 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (run_vm_tests+0x41a1e5c)
    #21 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (run_vm_tests+0x41a2845)
    #22 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:153 (run_vm_tests+0x40ae512)

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

  Thread T4 'DartWorker' (tid=15880, running) created by main thread at:
    #0 pthread_create ../recipe_cleanup/clangshYTOG/llvm_build_dir/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:962 (run_vm_tests+0x39d759b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:172 (run_vm_tests+0x40ae39c)
    #2 dart::ThreadPool::Worker::StartThread() ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296 (run_vm_tests+0x41a1519)
    #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 (run_vm_tests+0x41a1519)
    #4 bool dart::ThreadPool::Run<dart::MessageHandlerTask, dart::MessageHandler*>(dart::MessageHandler*&&) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46 (run_vm_tests+0x3fc4bbd)
    #5 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:121 (run_vm_tests+0x3fc4bbd)
    #6 Dart_NewNativePort ../../out/ReleaseTSANX64/../../runtime/vm/native_api_impl.cc:90 (run_vm_tests+0x48e9a10)
    #7 KernelCompilationRequest ../../out/ReleaseTSANX64/../../runtime/vm/kernel_isolate.cc:437 (run_vm_tests+0x3faf505)
    #8 dart::KernelIsolate::CompileToKernel(char const*, unsigned char const*, long, int, Dart_SourceFile*, bool, char const*, char const*, char const*) ../../out/ReleaseTSANX64/../../runtime/vm/kernel_isolate.cc:1031 (run_vm_tests+0x3faf505)
    #9 dart::TestCase::CompileTestScriptWithDFE(char const*, int, Dart_SourceFile*, unsigned char const**, long*, bool, bool, char const*, char const*) ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:328 (run_vm_tests+0x3be96a1)
    #10 dart::TestCase::LoadTestScriptWithDFE(int, Dart_SourceFile*, void (*(*)(_Dart_Handle*, int, bool*))(_Dart_NativeArguments*), bool, bool, bool, char const*, char const*, char const*) ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:482 (run_vm_tests+0x3be9cf9)
    #11 dart::TestCase::LoadTestScript(char const*, void (*(*)(_Dart_Handle*, int, bool*))(_Dart_NativeArguments*), char const*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:430 (run_vm_tests+0x3be9bbb)
    #12 dart::LoadTestScript(char const*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:162 (run_vm_tests+0x3b970b9)
    #13 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2332 (run_vm_tests+0x3b94904)
    #14 dart::Dart_TestProfiler_GetSourceReport() ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2305 (run_vm_tests+0x3b94904)
    #15 dart::TestCase::Run() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:52 (run_vm_tests+0x3a477ec)
    #16 dart::TestCaseBase::RunTest() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:64 (run_vm_tests+0x3a479c1)
    #17 dart::TestCaseBase::RunAll() ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:86 (run_vm_tests+0x3be8508)
    #18 dart::Main(int, char const**) ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:394 (run_vm_tests+0x3a484d3)
    #19 main ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:425 (run_vm_tests+0x3a47d3e)

SUMMARY: ThreadSanitizer: data race ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:367 in dart::Sample::head_sample() const
==================
==================
WARNING: ThreadSanitizer: data race (pid=15872)
  Read of size 8 at 0x7f4547319f98 by main thread:
    #0 dart::Sample::port() const ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:197 (run_vm_tests+0x3b949bc)
    #1 dart::SampleBuffer::VisitSamples(dart::SampleVisitor*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:645 (run_vm_tests+0x3b949bc)
    #2 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2340 (run_vm_tests+0x3b949bc)
    #3 dart::Dart_TestProfiler_GetSourceReport() ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2305 (run_vm_tests+0x3b949bc)
    #4 dart::TestCase::Run() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:52 (run_vm_tests+0x3a477ec)
    #5 dart::TestCaseBase::RunTest() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:64 (run_vm_tests+0x3a479c1)
    #6 dart::TestCaseBase::RunAll() ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:86 (run_vm_tests+0x3be8508)
    #7 dart::Main(int, char const**) ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:394 (run_vm_tests+0x3a484d3)
    #8 main ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:425 (run_vm_tests+0x3a47d3e)

  Previous write of size 8 at 0x7f4547319f98 by thread T4:
    #0 memset ../recipe_cleanup/clangshYTOG/llvm_build_dir/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:784 (run_vm_tests+0x39e0e59)
    #1 dart::Sample::Clear() ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:204 (run_vm_tests+0x40b7523)
    #2 dart::Sample::Init(long, long, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:191 (run_vm_tests+0x40b7523)
    #3 dart::SetupSample(dart::Thread*, dart::SampleBuffer*, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.cc:985 (run_vm_tests+0x40b7523)
    #4 dart::Profiler::SampleThread(dart::Thread*, dart::InterruptedThreadState const&) ../../out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1362 (run_vm_tests+0x40b7523)
    #5 dart::ThreadInterrupterLinux::ThreadInterruptSignalHandler(int, siginfo_t*, void*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_interrupter_linux.cc:47 (run_vm_tests+0x41a0c57)
    #6 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) ../recipe_cleanup/clangshYTOG/llvm_build_dir/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1907 (run_vm_tests+0x39ddd2f)
    #7 StackResource ../../out/ReleaseTSANX64/../../runtime/vm/allocation.h:25 (run_vm_tests+0x3fc7c66)
    #8 ThreadStackResource ../../out/ReleaseTSANX64/../../runtime/vm/thread_stack_resource.h:21 (run_vm_tests+0x3fc7c66)
    #9 TransitionSafepointState ../../out/ReleaseTSANX64/../../runtime/vm/heap/safepoint.h:162 (run_vm_tests+0x3fc7c66)
    #10 TransitionGeneratedToVM ../../out/ReleaseTSANX64/../../runtime/vm/heap/safepoint.h:181 (run_vm_tests+0x3fc7c66)
    #11 dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) ../../out/ReleaseTSANX64/../../runtime/vm/native_entry.cc:135 (run_vm_tests+0x3fc7c66)
    #12 <null> <null> (memfd:dart-codespace (deleted)+0x22f3)
    #13 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:147 (run_vm_tests+0x3f20ab2)
    #14 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37 (run_vm_tests+0x3f24b5f)
    #15 dart::DartLibraryCalls::HandleMessage(dart::Object const&, dart::Instance const&) ../../out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:792 (run_vm_tests+0x3f24b5f)
    #16 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message> >) ../../out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1379 (run_vm_tests+0x3f7ac5a)
    #17 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:233 (run_vm_tests+0x3fc50a0)
    #18 dart::MessageHandler::TaskCallback() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:443 (run_vm_tests+0x3fc5aa4)
    #19 dart::MessageHandlerTask::Run() ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31 (run_vm_tests+0x3fc6493)
    #20 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158 (run_vm_tests+0x41a1e5c)
    #21 dart::ThreadPool::Worker::Main(unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:323 (run_vm_tests+0x41a2845)
    #22 dart::ThreadStart(void*) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:153 (run_vm_tests+0x40ae512)

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

  Thread T4 'DartWorker' (tid=15880, running) created by main thread at:
    #0 pthread_create ../recipe_cleanup/clangshYTOG/llvm_build_dir/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:962 (run_vm_tests+0x39d759b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:172 (run_vm_tests+0x40ae39c)
    #2 dart::ThreadPool::Worker::StartThread() ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296 (run_vm_tests+0x41a1519)
    #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 (run_vm_tests+0x41a1519)
    #4 bool dart::ThreadPool::Run<dart::MessageHandlerTask, dart::MessageHandler*>(dart::MessageHandler*&&) ../../out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46 (run_vm_tests+0x3fc4bbd)
    #5 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) ../../out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:121 (run_vm_tests+0x3fc4bbd)
    #6 Dart_NewNativePort ../../out/ReleaseTSANX64/../../runtime/vm/native_api_impl.cc:90 (run_vm_tests+0x48e9a10)
    #7 KernelCompilationRequest ../../out/ReleaseTSANX64/../../runtime/vm/kernel_isolate.cc:437 (run_vm_tests+0x3faf505)
    #8 dart::KernelIsolate::CompileToKernel(char const*, unsigned char const*, long, int, Dart_SourceFile*, bool, char const*, char const*, char const*) ../../out/ReleaseTSANX64/../../runtime/vm/kernel_isolate.cc:1031 (run_vm_tests+0x3faf505)
    #9 dart::TestCase::CompileTestScriptWithDFE(char const*, int, Dart_SourceFile*, unsigned char const**, long*, bool, bool, char const*, char const*) ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:328 (run_vm_tests+0x3be96a1)
    #10 dart::TestCase::LoadTestScriptWithDFE(int, Dart_SourceFile*, void (*(*)(_Dart_Handle*, int, bool*))(_Dart_NativeArguments*), bool, bool, bool, char const*, char const*, char const*) ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:482 (run_vm_tests+0x3be9cf9)
    #11 dart::TestCase::LoadTestScript(char const*, void (*(*)(_Dart_Handle*, int, bool*))(_Dart_NativeArguments*), char const*, bool, bool) ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:430 (run_vm_tests+0x3be9bbb)
    #12 dart::LoadTestScript(char const*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:162 (run_vm_tests+0x3b970b9)
    #13 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2332 (run_vm_tests+0x3b94904)
    #14 dart::Dart_TestProfiler_GetSourceReport() ../../out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2305 (run_vm_tests+0x3b94904)
    #15 dart::TestCase::Run() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:52 (run_vm_tests+0x3a477ec)
    #16 dart::TestCaseBase::RunTest() ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:64 (run_vm_tests+0x3a479c1)
    #17 dart::TestCaseBase::RunAll() ../../out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:86 (run_vm_tests+0x3be8508)
    #18 dart::Main(int, char const**) ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:394 (run_vm_tests+0x3a484d3)
    #19 main ../../out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:425 (run_vm_tests+0x3a47d3e)

SUMMARY: ThreadSanitizer: data race ../../out/ReleaseTSANX64/../../runtime/vm/profiler.h:197 in dart::Sample::port() const
==================
Source positions for function 'file:///test-lib_::_doWork' {
7f4547c80350-7f4547c80389: Function 'doWork': static.@-12
7f4547c8038a-7f4547c80392: Function 'doWork': static.@-7
7f4547c80393-7f4547c803a5: Function 'doWork': static.@11
7f4547c803a6-7f4547c803bd: Function 'doWork': static.@19
7f4547c803be-7f4547c803c0: Function 'doWork': static.@19
7f4547c803c1-7f4547c803c3: Function 'doWork': static.@-1
7f4547c803c4-7f4547c803ef: Function 'doWork': static.@19
7f4547c803f0-7f4547c803f8: Function 'doWork': static.@17
7f4547c803f9-7f4547c80413: Function 'doWork': static.@0
7f4547c80414-7f4547c80415: Function 'doWork': static.@0
}
Source positions for function 'file:///test-lib_::_main' {
7f4547c80190-7f4547c801d1: Function 'main': static.@-12
7f4547c801d2-7f4547c801da: Function 'main': static.@-7
7f4547c801db-7f4547c801ed: Function 'main': static.@32
7f4547c801ee-7f4547c801f6: Function 'main': static.@47
7f4547c801f7-7f4547c80205: Function 'main': static.@65
7f4547c80206-7f4547c8020b: Function 'main': static.@63
7f4547c8020c-7f4547c80214: Function 'main': static.@-7
7f4547c80215-7f4547c80238: Function 'main': static.@54
7f4547c80239-7f4547c8023b: Function 'main': static.@-1
7f4547c8023c-7f4547c80252: Function 'main': static.@72
7f4547c80253-7f4547c8026f: Function 'main': static.@72
7f4547c80270-7f4547c80276: Function 'main': static.@-5
7f4547c80277-7f4547c80299: Function 'main': static.@98
7f4547c8029a-7f4547c802ad: Function 'main': static.@95
7f4547c802ae-7f4547c802af: Function 'main': static.@95
7f4547c802b0-7f4547c802b3: Function 'main': static.@91
7f4547c802b4-7f4547c802b6: Function 'main': static.@-1
7f4547c802b7-7f4547c802ca: Function 'main': static.@80
7f4547c802cb-7f4547c802cc: Function 'main': static.@80
7f4547c802cd-7f4547c802d0: Function 'main': static.@79
7f4547c802d1-7f4547c802e7: Function 'main': static.@-7
7f4547c802e8-7f4547c802f3: Function 'main': static.@115
7f4547c802f4-7f4547c8030e: Function 'main': static.@24
7f4547c8030f-7f4547c8032f: Function 'main': static.@54
7f4547c80330-7f4547c80334: Function 'main': static.@54
}
ThreadSanitizer: reported 2 warnings

--- Re-run this test:
python tools/test.py -n dartk-tsan-linux-release-x64 vm/cc/Profiler_GetSourceReport

/cc @bkonyi @rmacnak-google

@mkustermann mkustermann added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. gardening labels Nov 6, 2020
@sstrickl
Copy link
Contributor

sstrickl commented Jun 9, 2023

It's now gone back to Crash after a few months of flakiness since the revert of ad706a9, log:

--- Command "run_vm_unittest" (took 16.000040s):
DART_CONFIGURATION=ReleaseTSANX64 out/ReleaseTSANX64/run_vm_tests --dfe=/b/s/w/ir/out/ReleaseTSANX64/gen/kernel-service.dart.snapshot --enable-experiment=records --sound-null-safety --ignore-unrecognized-flags Profiler_GetSourceReport

exit code:
-6

stdout:
Running test: Profiler_GetSourceReport

stderr:
/b/s/w/ir/buildtools/linux-x64/clang/bin/llvm-symbolizer: error: '/memfd:dart-code (deleted)': No such file or directory
==================
WARNING: ThreadSanitizer: data race (pid=572194)
  Read of size 4 at 0x7f089bedae18 by main thread:
    #0 dart::Sample::head_sample() const out/ReleaseTSANX64/../../runtime/vm/profiler.h:350:59 (run_vm_tests+0x250a127)
    #1 dart::SampleBuffer::VisitSamples(dart::SampleVisitor*) out/ReleaseTSANX64/../../runtime/vm/profiler.h:598:20 (run_vm_tests+0x250a127)
    #2 dart::SampleBlockBuffer::VisitSamples(dart::SampleVisitor*) out/ReleaseTSANX64/../../runtime/vm/profiler.h:761:18 (run_vm_tests+0x250a127)
    #3 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2241:26 (run_vm_tests+0x250a127)
    #4 dart::Dart_TestProfiler_GetSourceReport() out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2206:1 (run_vm_tests+0x250a127)
    #5 dart::TestCase::Run() out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:52:3 (run_vm_tests+0x228192c)
    #6 dart::TestCaseBase::RunTest() out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:64:11 (run_vm_tests+0x2281b01)
    #7 dart::TestCaseBase::RunAll() out/ReleaseTSANX64/../../runtime/vm/unit_test.cc:86:13 (run_vm_tests+0x256ca58)
    #8 dart::Main(int, char const**) out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:405:3 (run_vm_tests+0x2282129)
    #9 main out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:436:29 (run_vm_tests+0x2281cc0)

  Previous write of size 4 at 0x7f089bedae18 by thread T5:
    #0 dart::Sample::set_thread_task(dart::Thread::TaskKind) out/ReleaseTSANX64/../../runtime/vm/profiler.h:325:12 (run_vm_tests+0x2ae5da2)
    #1 dart::SetupSample(dart::Thread*, bool, unsigned long) out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1216:11 (run_vm_tests+0x2ae5da2)
    #2 dart::Profiler::SampleThread(dart::Thread*, dart::InterruptedThreadState const&) out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1371:7 (run_vm_tests+0x2ae5da2)
    #3 dart::ThreadInterrupterLinux::ThreadInterruptSignalHandler(int, siginfo_t*, void*) out/ReleaseTSANX64/../../runtime/vm/thread_interrupter_linux.cc:44:5 (run_vm_tests+0x2bcba1c)
    #4 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:2122:5 (run_vm_tests+0x220117f)
    #5 dart::Mutex::Unlock() out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:367:16 (run_vm_tests+0x2adc199)
    #6 dart::MutexLocker::~MutexLocker() out/ReleaseTSANX64/../../runtime/vm/lockers.h:69:13 (run_vm_tests+0x2ae0f91)
    #7 dart::PortMap::PostMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message>>, bool) out/ReleaseTSANX64/../../runtime/vm/port.cc:221:1 (run_vm_tests+0x2ae0f91)
    #8 dart::DN_HelperSendPort_sendInternal_(dart::Isolate*, dart::Thread*, dart::Zone*, dart::NativeArguments*) out/ReleaseTSANX64/../../runtime/lib/isolate.cc:121:3 (run_vm_tests+0x2846ee4)
    #9 dart::BootstrapNatives::DN_SendPort_sendInternal_(dart::Thread*, dart::Zone*, dart::NativeArguments*) out/ReleaseTSANX64/../../runtime/lib/isolate.cc:107:1 (run_vm_tests+0x2846ee4)
    #10 dart::NativeEntry::BootstrapNativeCallWrapper(_Dart_NativeArguments*, void (*)(_Dart_NativeArguments*)) out/ReleaseTSANX64/../../runtime/vm/native_entry.cc:140:37 (run_vm_tests+0x29c5d50)
    #11 <null> <null> (memfd:dart-code (deleted)+0x2caa)
    #12 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:37:10 (run_vm_tests+0x2910b9d)
    #13 dart::DartLibraryCalls::HandleMessage(long, dart::Instance const&) out/ReleaseTSANX64/../../runtime/vm/dart_entry.cc:737:28 (run_vm_tests+0x2910b9d)
    #14 dart::IsolateMessageHandler::HandleMessage(std::__2::unique_ptr<dart::Message, std::__2::default_delete<dart::Message>>) out/ReleaseTSANX64/../../runtime/vm/isolate.cc:1292:15 (run_vm_tests+0x296523b)
    #15 dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:239:16 (run_vm_tests+0x29a9f83)
    #16 dart::MessageHandler::TaskCallback() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:458:18 (run_vm_tests+0x29aaa60)
    #17 dart::MessageHandlerTask::Run() out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:31:15 (run_vm_tests+0x29ab3f3)
    #18 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158:15 (run_vm_tests+0x2bcca29)
    #19 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:330:9 (run_vm_tests+0x2bcd2e7)
    #20 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (run_vm_tests+0x2adbb53)

  Thread T5 'DartWorker' (tid=572249, running) created by thread T2 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:1048:3 (run_vm_tests+0x21f8e2b)
    #1 dart::OSThread::Start(char const*, void (*)(unsigned long), unsigned long) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:173:12 (run_vm_tests+0x2adba03)
    #2 dart::ThreadPool::Worker::StartThread() out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:296:16 (run_vm_tests+0x2bcc100)
    #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:17 (run_vm_tests+0x2bcc100)
    #4 bool dart::ThreadPool::Run<dart::MessageHandlerTask, dart::MessageHandler*>(dart::MessageHandler*&&) out/ReleaseTSANX64/../../runtime/vm/thread_pool.h:46:12 (run_vm_tests+0x29a9b71)
    #5 dart::MessageHandler::Run(dart::ThreadPool*, dart::MessageHandler::MessageStatus (*)(unsigned long), void (*)(unsigned long), unsigned long) out/ReleaseTSANX64/../../runtime/vm/message_handler.cc:120:24 (run_vm_tests+0x29a9b71)
    #6 dart::RunKernelTask::Run() out/ReleaseTSANX64/../../runtime/vm/kernel_isolate.cc:111:33 (run_vm_tests+0x2998a6d)
    #7 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:158:15 (run_vm_tests+0x2bcca29)
    #8 dart::ThreadPool::Worker::Main(unsigned long) out/ReleaseTSANX64/../../runtime/vm/thread_pool.cc:330:9 (run_vm_tests+0x2bcd2e7)
    #9 dart::ThreadStart(void*) out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:154:5 (run_vm_tests+0x2adbb53)

SUMMARY: ThreadSanitizer: data race out/ReleaseTSANX64/../../runtime/vm/profiler.h:350:59 in dart::Sample::head_sample() const
==================

--- Re-run this test:
python3 tools/test.py -n vm-tsan-linux-release-x64 vm/cc/Profiler_GetSourceReport

copybara-service bot pushed a commit that referenced this issue Feb 12, 2025
…terrupted

Thread interrupts can be disabled after thread interrupter decided to
interrupt a thread but before thread actually receives and handles
a signal.

This may cause a data race accessing a Sample between profiler which
initializes and adds a Sample and the main thread using
Profiler::sample_block_buffer() in the profiler unit tests.

This is a possible fix for the following benign TSAN error:

WARNING: ThreadSanitizer: data race (pid=5824)
  Write of size 4 at 0x7f53e8e53a98 by thread T6:
    #0 dart::Sample::set_thread_task(dart::Thread::TaskKind) out/ReleaseTSANX64/../../runtime/vm/profiler.h:325:12 (run_vm_tests+0x292cab2)
    #1 dart::SetupSample(dart::Thread*, bool, unsigned long) out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1226:11 (run_vm_tests+0x292cab2)
    #2 dart::Profiler::SampleThread(dart::Thread*, dart::InterruptedThreadState const&) out/ReleaseTSANX64/../../runtime/vm/profiler.cc:1381:7 (run_vm_tests+0x292cab2)
    #3 dart::ThreadInterrupterLinux::ThreadInterruptSignalHandler(int, siginfo_t*, void*) out/ReleaseTSANX64/../../runtime/vm/thread_interrupter_linux.cc:44:5 (run_vm_tests+0x2a064b0)
    #4 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int, __sanitizer::__sanitizer_siginfo*, void*) ../staging/llvm_build/tools/clang/stage2-bins/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:2122:5 (run_vm_tests+0x1fc057f)
    #5 dart::Mutex::Unlock() out/ReleaseTSANX64/../../runtime/vm/os_thread_linux.cc:367:16 (run_vm_tests+0x2924b89)

  Previous read of size 4 at 0x7f53e8e53a98 by main thread:
    #0 dart::Sample::head_sample() const out/ReleaseTSANX64/../../runtime/vm/profiler.h:350:59 (run_vm_tests+0x22c70e7)
    #1 dart::SampleBuffer::VisitSamples(dart::SampleVisitor*) out/ReleaseTSANX64/../../runtime/vm/profiler.h:589:20 (run_vm_tests+0x22c70e7)
    #2 dart::SampleBlockBuffer::VisitSamples(dart::SampleVisitor*) out/ReleaseTSANX64/../../runtime/vm/profiler.h:752:18 (run_vm_tests+0x22c70e7)
    #3 dart::Dart_TestHelperProfiler_GetSourceReport(dart::Thread*) out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2241:26 (run_vm_tests+0x22c70e7)
    #4 dart::Dart_TestProfiler_GetSourceReport() out/ReleaseTSANX64/../../runtime/vm/profiler_test.cc:2206:1 (run_vm_tests+0x22c70e7)
    #5 dart::TestCase::Run() out/ReleaseTSANX64/../../runtime/bin/run_vm_tests.cc:53:3 (run_vm_tests+0x203fe6c)

--- Re-run this test:
python3 tools/test.py -n vm-tsan-linux-release-x64 vm/cc/Profiler_GetSourceReport

Also, this change is a possible fix for #44089.

TEST=ci

Change-Id: I8ad87c340580325cbd6e22b5f068e1e33b0a7d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409460
Reviewed-by: Ryan Macnak <[email protected]>
Commit-Queue: Alexander Markov <[email protected]>
@alexmarkov
Copy link
Contributor

Tentatively closing this issue as the test has been passing and not flaky since possible fix landed:

https://dart-ci.firebaseapp.com/#showLatestFailures=false&test=vm/cc/Profiler_GetSourceReport

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