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

Tests test_global_control, test_tbb_fork sporadically hangs on Apple Silicon #711

Closed
phprus opened this issue Jan 2, 2022 · 4 comments · Fixed by #739
Closed

Tests test_global_control, test_tbb_fork sporadically hangs on Apple Silicon #711

phprus opened this issue Jan 2, 2022 · 4 comments · Fixed by #739
Assignees
Labels

Comments

@phprus
Copy link
Contributor

phprus commented Jan 2, 2022

Commit: d1667d5
Release build with LTO.

Compiler:

Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.2.0
Thread model: posix

Time:

phprus@mbp ~% ps ax | grep test_global_control
57221 s003  R+   100:52.86 /...../test_global_control --force-colors=1
58186 s004  S+     0:00.00 grep test_global_control

CPU (full 1 core load):

PID    COMMAND      %CPU TIME     #TH    #WQ  #PORT MEM    PURG   CMPR PGRP  PPID  STATE    BOOSTS           %CPU_ME %CPU_OTHRS UID  FAULTS    COW    MSGSENT
57221  test_global_ 97.7 01:42:02 10/1   0    275   3409K  0B     0B   56395 56395 running  *0[1]            0.00000 0.00000    501  587       63     8852

Test output:

    Start 303: test_global_control
1/1 Test #303: test_global_control ..............Subprocess terminated***Exception: 306.73 sec
[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
/...../test/tbb/test_global_control.cpp:250:
TEST CASE:  prolong lifetime multiple wait

/...../test/tbb/test_global_control.cpp:250: FATAL ERROR: test case CRASHED: SIGTERM - Termination request signal

===============================================================================
[doctest] test cases:  4 |  3 passed | 1 failed | 0 skipped
[doctest] assertions: 63 | 63 passed | 0 failed |
[doctest] Status: FAILURE!

lldb:

(lldb) process attach -p 59340
Process 59340 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
Target 0: (test_global_control) stopped.

Executable module set to "/...../test_global_control".
Architecture set to: arm64e-apple-macosx-.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x00000001b072873c libc++.1.dylib`std::__1::thread::join() + 36
    frame #3: 0x000000010046b264 test_global_control`void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&) + 368
    frame #4: 0x000000010046ae80 test_global_control`TestBlockingTerminateNS::TestMultpleWait() + 192
    frame #5: 0x0000000100468ce0 test_global_control`doctest::Context::run() + 4184
    frame #6: 0x000000010046aa38 test_global_control`main + 40
    frame #7: 0x00000001005910f4 dyld`start + 520
(lldb) thread list
Process 59340 stopped
* thread #1: tid = 0x20c390, 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x20c6ff, 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
  thread #3: tid = 0x20c707, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #4: tid = 0x20c708, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #5: tid = 0x20c709, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #6: tid = 0x20c70a, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #7: tid = 0x20c70b, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #8: tid = 0x20c70c, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #9: tid = 0x20c70d, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
  thread #10: tid = 0x20c70e, 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
  thread #11: tid = 0x20c70f, 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
(lldb) thread select 2
* thread #2
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
(lldb) bt
* thread #2
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x0000000100501ca4 libtbb.12.dylib`tbb::detail::r1::rml::private_server::request_close_connection(bool) + 216
    frame #3: 0x00000001004fdf1c libtbb.12.dylib`tbb::detail::r1::market::release(bool, bool) + 368
    frame #4: 0x00000001004fb360 libtbb.12.dylib`tbb::detail::r1::finalize(tbb::detail::d1::task_scheduler_handle&, long) + 248
    frame #5: 0x000000010047eed4 test_global_control`TestBlockingTerminateNS::TestMultpleWaitBody::operator()(int) const + 1172
    frame #6: 0x000000010047e9e0 test_global_control`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()> >(void*) + 48
    frame #7: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 3
* thread #3
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #3
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 4
* thread #4
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #4
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 5
* thread #5
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #5
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 6
* thread #6
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #6
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 7
* thread #7
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #7
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 8
* thread #8
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #8
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 9
* thread #9
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #9
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 10
* thread #10
    frame #0: 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
libsystem_kernel.dylib`swtch_pri:
->  0x1b0791a5c <+8>: ret

libsystem_kernel.dylib`swtch:
    0x1b0791a60 <+0>: mov    x16, #-0x3c
    0x1b0791a64 <+4>: svc    #0x80
    0x1b0791a68 <+8>: ret
(lldb) bt
* thread #10
  * frame #0: 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
    frame #1: 0x00000001b07ca0e4 libsystem_pthread.dylib`cthread_yield + 20
    frame #2: 0x00000001005014a8 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 716
    frame #3: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 11
* thread #11
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #11
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000100501468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb)
@phprus
Copy link
Contributor Author

phprus commented Jan 3, 2022

RelWithDebInfo + CXXFLAGS="-DTBB_USE_ASSERT=1"

Output:

[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
/Users/phprus/Devel/oneapi-src/tmp/oneTBB-d1667d514df697f05d771602b268e92560c434c4/test/tbb/test_global_control.cpp:250:
TEST CASE:  prolong lifetime multiple wait

/Users/phprus/Devel/oneapi-src/tmp/oneTBB-d1667d514df697f05d771602b268e92560c434c4/test/tbb/test_global_control.cpp:250: FATAL ERROR: test case CRASHED: SIGTERM - Termination request signal

===============================================================================
[doctest] test cases:  4 |  3 passed | 1 failed | 0 skipped
[doctest] assertions: 50 | 50 passed | 0 failed |
[doctest] Status: FAILURE!

Backtraces:

(lldb) process attach --pid 46399
Process 46399 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
Target 0: (test_global_control) stopped.

Executable module set to "/Users/phprus/Devel/oneapi-src/tmp/oneTBB-d1667d514df697f05d771602b268e92560c434c4/build/osx_arm64-rwd/appleclang_13.0_cxx17_64_relwithdebinfo/test_global_control".
Architecture set to: arm64e-apple-macosx-.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x00000001b072873c libc++.1.dylib`std::__1::thread::join() + 36
    frame #3: 0x0000000100682b14 test_global_control`void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(Number=<unavailable>, body=0x000000016f78b038) at utils.h:84:16 [opt]
    frame #4: 0x0000000100682740 test_global_control`TestBlockingTerminateNS::TestMultpleWait() at test_global_control.cpp:119:17 [opt]
    frame #5: 0x000000010068068c test_global_control`doctest::Context::run(this=<unavailable>) at doctest.h:6586:21 [opt]
    frame #6: 0x00000001006822f8 test_global_control`main(argc=<unavailable>, argv=<unavailable>) at doctest.h:6671:71 [opt]
    frame #7: 0x00000001008150f4 dyld`start + 520
(lldb) thread select 2
* thread #2
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
(lldb) bt
* thread #2
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x000000010094d364 libtbb.12.6.dylib`tbb::detail::r1::rml::private_server::request_close_connection(bool) + 264
    frame #3: 0x0000000100947a0c libtbb.12.6.dylib`tbb::detail::r1::market::release(bool, bool) + 692
    frame #4: 0x0000000100944208 libtbb.12.6.dylib`tbb::detail::r1::finalize(tbb::detail::d1::task_scheduler_handle&, long) + 328
    frame #5: 0x0000000100696b2c test_global_control`TestBlockingTerminateNS::TestMultpleWaitBody::operator()(int) const [inlined] tbb::detail::d1::finalize(handle=0x000000016f9b6ea8) at global_control.h:181:21 [opt]
    frame #6: 0x0000000100696b18 test_global_control`TestBlockingTerminateNS::TestMultpleWaitBody::operator(this=0x000000016f78b038, (null)=<unavailable>)(int) const at test_global_control.cpp:105:33 [opt]
    frame #7: 0x00000001006966d4 test_global_control`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()> >(void*) [inlined] void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(this=0x00006000011a8088)::'lambda'()::operator()() const at utils.h:74:13 [opt]
    frame #8: 0x00000001006966c8 test_global_control`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()> >(void*) [inlined] decltype(__f=0x00006000011a8088)(std::__1::forward<TestBlockingTerminateNS::TestMultpleWaitBody>(fp0)...)) std::__1::__invoke<void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()>(int&&, TestBlockingTerminateNS::TestMultpleWaitBody&&...) at type_traits:3694:1 [opt]
    frame #9: 0x00000001006966c8 test_global_control`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()> >(void*) [inlined] void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()>(__t=size=2)::'lambda'()...>&, std::__1::__tuple_indices<>) at thread:286:5 [opt]
    frame #10: 0x00000001006966c8 test_global_control`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()> >(__vp=0x00006000011a8080) at thread:297:5 [opt]
    frame #11: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 3
* thread #3
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #3
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 4
* thread #4
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #4
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 5
* thread #5
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #5
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 6
* thread #6
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #6
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 7
* thread #7
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #7
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 8
* thread #8
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #8
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 9
* thread #9
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #9
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 10
* thread #10
    frame #0: 0x0000000100956dac libtbb.12.6.dylib`sched_yield + 4
libtbb.12.6.dylib`sched_yield:
->  0x100956dac <+4>: ldr    x16, [x16, #0x2a0]
    0x100956db0 <+8>: br     x16

libtbb.12.6.dylib`semaphore_create:
    0x100956db4 <+0>: adrp   x16, 10
    0x100956db8 <+4>: ldr    x16, [x16, #0x2a8]
(lldb) bt
* thread #10
  * frame #0: 0x0000000100956dac libtbb.12.6.dylib`sched_yield + 4
    frame #1: 0x000000010094c960 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 624
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 11
* thread #11
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #11
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x000000010094c908 libtbb.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 536
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb)

@phprus
Copy link
Contributor Author

phprus commented Jan 3, 2022

Debug

Output:

[doctest] doctest version is "2.4.6"
[doctest] run with "--help" for options
===============================================================================
/Users/phprus/Devel/oneapi-src/tmp/oneTBB-d1667d514df697f05d771602b268e92560c434c4/test/tbb/test_global_control.cpp:250:
TEST CASE:  prolong lifetime multiple wait

/Users/phprus/Devel/oneapi-src/tmp/oneTBB-d1667d514df697f05d771602b268e92560c434c4/test/tbb/test_global_control.cpp:250: FATAL ERROR: test case CRASHED: SIGTERM - Termination request signal

===============================================================================
[doctest] test cases:  4 |  3 passed | 1 failed | 0 skipped
[doctest] assertions: 25 | 25 passed | 0 failed |
[doctest] Status: FAILURE!

Backtraces:

(lldb) process attach --pid 48731
Process 48731 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
Target 0: (test_global_control) stopped.

Executable module set to "/Users/phprus/Devel/oneapi-src/tmp/oneTBB-d1667d514df697f05d771602b268e92560c434c4/build/osx_arm64-debug/appleclang_13.0_cxx17_64_debug/test_global_control".
Architecture set to: arm64e-apple-macosx-.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x00000001b072873c libc++.1.dylib`std::__1::thread::join() + 36
    frame #3: 0x000000010438882c test_global_control`void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(Number=15, body=0x000000016ba86c1b) at utils.h:84:16
    frame #4: 0x000000010438856c test_global_control`TestBlockingTerminateNS::TestMultpleWait() at test_global_control.cpp:119:17
    frame #5: 0x000000010438a3a8 test_global_control`_DOCTEST_ANON_FUNC_40() at test_global_control.cpp:251:5
    frame #6: 0x00000001043861f4 test_global_control`doctest::Context::run(this=0x000000016ba874d8) at doctest.h:6586:21
    frame #7: 0x0000000104387f50 test_global_control`main(argc=2, argv=0x000000016ba87660) at doctest.h:6671:71
    frame #8: 0x00000001045e90f4 dyld`start + 520
(lldb) thread select 2
* thread #2
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
(lldb) bt
* thread #2
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x00000001047cf050 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::join(_opaque_pthread_t*) + 28
    frame #3: 0x00000001047cf2c4 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::release_handle(_opaque_pthread_t*, bool) + 36
    frame #4: 0x00000001047cf398 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::start_shutdown() + 188
    frame #5: 0x00000001047d0234 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_server::request_close_connection(bool) + 68
    frame #6: 0x00000001047c4af4 libtbb_debug.12.6.dylib`tbb::detail::r1::market::release(bool, bool) + 628
    frame #7: 0x00000001047bdc2c libtbb_debug.12.6.dylib`tbb::detail::r1::finalize_impl(tbb::detail::d1::task_scheduler_handle&) + 380
    frame #8: 0x00000001047bdccc libtbb_debug.12.6.dylib`tbb::detail::r1::finalize(tbb::detail::d1::task_scheduler_handle&, long) + 60
    frame #9: 0x0000000104389d74 test_global_control`tbb::detail::d1::finalize(handle=0x000000016c22adc8, (null)=0x00000001b076d942) at global_control.h:181:21
    frame #10: 0x00000001043b90bc test_global_control`TestBlockingTerminateNS::TestMultpleWaitBody::operator(this=0x000000016ba86c1b, (null)=13)(int) const at test_global_control.cpp:105:33
    frame #11: 0x00000001043b8d00 test_global_control`void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(this=0x00006000015941a8)::'lambda'()::operator()() const at utils.h:74:13
    frame #12: 0x00000001043b8c98 test_global_control`decltype(__f=0x00006000015941a8)(std::__1::forward<TestBlockingTerminateNS::TestMultpleWaitBody>(fp0)...)) std::__1::__invoke<void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()>(int&&, TestBlockingTerminateNS::TestMultpleWaitBody&&...) at type_traits:3694:1
    frame #13: 0x00000001043b8c70 test_global_control`void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()>(__t=size=2, (null)=__tuple_indices<> @ 0x000000016c22af7f)::'lambda'()...>&, std::__1::__tuple_indices<>) at thread:286:5
    frame #14: 0x00000001043b88f4 test_global_control`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void utils::NativeParallelFor<int, TestBlockingTerminateNS::TestMultpleWaitBody>(int, TestBlockingTerminateNS::TestMultpleWaitBody const&)::'lambda'()> >(__vp=0x00006000015941a0) at thread:297:5
    frame #15: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 3
* thread #3
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #3
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 4
* thread #4
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #4
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 5
* thread #5
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #5
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 6
* thread #6
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #6
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 7
* thread #7
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #7
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 8
* thread #8
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #8
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 9
* thread #9
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #9
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 10
* thread #10
    frame #0: 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
libsystem_kernel.dylib`swtch_pri:
->  0x1b0791a5c <+8>: ret

libsystem_kernel.dylib`swtch:
    0x1b0791a60 <+0>: mov    x16, #-0x3c
    0x1b0791a64 <+4>: svc    #0x80
    0x1b0791a68 <+8>: ret
(lldb) bt
* thread #10
  * frame #0: 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
    frame #1: 0x00000001b07ca0e4 libsystem_pthread.dylib`cthread_yield + 20
    frame #2: 0x00000001047affa4 libtbb_debug.12.6.dylib`std::__1::__libcpp_thread_yield() + 12
    frame #3: 0x00000001047ab134 libtbb_debug.12.6.dylib`std::__1::this_thread::yield() + 12
    frame #4: 0x00000001047ae7d0 libtbb_debug.12.6.dylib`tbb::detail::d0::atomic_backoff::pause() + 64
    frame #5: 0x00000001047cf778 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 124
    frame #6: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #7: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #8: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 11
* thread #11
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #11
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x00000001047a4474 libtbb_debug.12.6.dylib`tbb::detail::r1::binary_semaphore::P() + 32
    frame #2: 0x00000001047cf754 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::internal::thread_monitor::commit_wait(tbb::detail::r1::rml::internal::thread_monitor::cookie&) + 88
    frame #3: 0x00000001047cf1e8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::run() + 208
    frame #4: 0x00000001047cf0f8 libtbb_debug.12.6.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 44
    frame #5: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb)

@anton-potapov
Copy link
Contributor

@alexey-katranov I believe this is related to #566 , due to this:

frame #4: 0x000000010438856c test_global_control`TestBlockingTerminateNS::TestMultpleWait() at test_global_control.cpp:119:17

@phprus
Copy link
Contributor Author

phprus commented Jan 10, 2022

@anton-potapov, @alexey-katranov
Very similar sporadically hangs in test test_tbb_fork.
Backtrace in test test_global_control (thread 2) and in test_tbb_fork (thread 1) is equal.

Backtrace for test_tbb_fork (release build with LTO):

% lldb --attach-pid 32063
(lldb) process attach --pid 32063
Process 32063 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
libsystem_kernel.dylib`__ulock_wait:
->  0x1b079370c <+8>:  b.lo   0x1b079372c               ; <+40>
    0x1b0793710 <+12>: pacibsp
    0x1b0793714 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b0793718 <+20>: mov    x29, sp
Target 0: (test_tbb_fork) stopped.

Executable module set to "/Users/phprus/..../onetbb_bin_release/test_tbb_fork".
Architecture set to: arm64e-apple-macosx-.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00000001b079370c libsystem_kernel.dylib`__ulock_wait + 8
    frame #1: 0x00000001b07cf574 libsystem_pthread.dylib`_pthread_join + 452
    frame #2: 0x0000000102e15ca4 libtbb.12.dylib`tbb::detail::r1::rml::private_server::request_close_connection(bool) + 216
    frame #3: 0x0000000102e11f1c libtbb.12.dylib`tbb::detail::r1::market::release(bool, bool) + 368
    frame #4: 0x0000000102e0f360 libtbb.12.dylib`tbb::detail::r1::finalize(tbb::detail::d1::task_scheduler_handle&, long) + 248
    frame #5: 0x0000000102d8909c test_tbb_fork`RunWorkersBody::operator()(int) const + 96
    frame #6: 0x0000000102d89a4c test_tbb_fork`main + 72
    frame #7: 0x0000000102e990f4 dyld`start + 520
(lldb) thread select 2
* thread #2
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #2
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 3
* thread #3
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #3
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 4
* thread #4
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #4
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 5
* thread #5
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #5
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 6
* thread #6
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #6
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 7
* thread #7
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #7
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 8
* thread #8
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #8
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 9
* thread #9
    frame #0: 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
libsystem_kernel.dylib`swtch_pri:
->  0x1b0791a5c <+8>: ret

libsystem_kernel.dylib`swtch:
    0x1b0791a60 <+0>: mov    x16, #-0x3c
    0x1b0791a64 <+4>: svc    #0x80
    0x1b0791a68 <+8>: ret
(lldb) bt
* thread #9
  * frame #0: 0x00000001b0791a5c libsystem_kernel.dylib`swtch_pri + 8
    frame #1: 0x00000001b07ca0e4 libsystem_pthread.dylib`cthread_yield + 20
    frame #2: 0x0000000102e154a8 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 716
    frame #3: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb) thread select 10
* thread #10
    frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
libsystem_kernel.dylib`semaphore_wait_trap:
->  0x1b0791990 <+8>: ret

libsystem_kernel.dylib`semaphore_wait_signal_trap:
    0x1b0791994 <+0>: mov    x16, #-0x25
    0x1b0791998 <+4>: svc    #0x80
    0x1b079199c <+8>: ret
(lldb) bt
* thread #10
  * frame #0: 0x00000001b0791990 libsystem_kernel.dylib`semaphore_wait_trap + 8
    frame #1: 0x0000000102e15468 libtbb.12.dylib`tbb::detail::r1::rml::private_worker::thread_routine(void*) + 652
    frame #2: 0x00000001b07cd240 libsystem_pthread.dylib`_pthread_start + 148
(lldb)

@phprus phprus changed the title Test test_global_control sporadically hangs on Apple Silicon Tests test_global_control, test_tbb_fork sporadically hangs on Apple Silicon Jan 10, 2022
@phprus phprus changed the title Tests test_global_control, test_tbb_fork sporadically hangs on Apple Silicon Tests test_global_control, test_tbb_fork sporadically hangs on Apple Silicon Jan 10, 2022
@pavelkumbrasev pavelkumbrasev self-assigned this Jan 12, 2022
@pavelkumbrasev pavelkumbrasev linked a pull request Jan 19, 2022 that will close this issue
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants