[compiler-rt] Fix flaky test: signal_in_mutex_lock.cpp (PR #92587)

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 11:32:35 PDT 2024


yln wrote:

Test added in #84162.  @canova

Seeing flaky failures for this test:
https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/780/testReport/junit/ThreadSanitizer-x86_64h/ThreadSanitizer-x86_64h/signal_in_mutex_lock_cpp/
```
(lldb) bt all
  thread #1, queue = 'com.apple.main-thread'
    ...
    frame #5: 0x000000018bfb67ec libsystem_c.dylib`__cxa_finalize_ranges + 476
    frame #6: 0x000000018bfb65b0 libsystem_c.dylib`exit + 44
    frame #7: 0x000000018c11ed58 libdyld.dylib`dyld4::LibSystemHelpers::exit(int) const + 20
    frame #8: 0x000000018bd722e4 dyld`start + 2952
* thread #3, stop reason = signal SIGABRT
  * frame #0: 0x000000018c0c2540 libsystem_kernel.dylib`__pthread_kill + 8
    ...
    frame #11: 0x000000018c030a44 libc++.1.dylib`std::__1::__throw_system_error[abi:ne180100](std::__1::error_code, char const*) + 92
    frame #12: 0x000000018c0309e8 libc++.1.dylib`std::__1::__throw_system_error(int, char const*) + 48
    frame #13: 0x000000018c032770 libc++.1.dylib`std::__1::mutex::lock() + 40
    frame #14: 0x00000001000033f0 signal_in_mutex_lock.cpp.tmp`::lock_guard() at lock_guard.h:35:10
    frame #15: 0x0000000100002f40 signal_in_mutex_lock.cpp.tmp`::lock_guard() at lock_guard.h:34:19
    frame #16: 0x0000000100002ed8 signal_in_mutex_lock.cpp.tmp`::ThreadFunc() at signal_in_mutex_lock.cpp:20:33
    frame #17: 0x00000001004da828 libclang_rt.tsan_osx_dynamic.dylib`__tsan_thread_start_func(arg=0x000000016fdfefd8) at tsan_interceptors_posix.cpp:1013:15 [opt]
    frame #18: 0x000000018c0faf40 libsystem_pthread.dylib`_pthread_start + 136
```

Mutex is destroyed from main thread (`__cxa_finalize_ranges()`) while the created thread is still spinning on it.

https://github.com/llvm/llvm-project/pull/92587


More information about the llvm-commits mailing list