roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.03k stars 205 forks source link

Print backtrace of all threads #565

Open gavv opened 9 months ago

gavv commented 9 months ago

die_gracefully() is invoked from signal handler (crash_handler.cpp) or panic (panic.cpp).

See https://github.com/roc-streaming/roc-toolkit/blob/develop/src/internal_modules/roc_core/target_posix/roc_core/die.cpp

Currently it prints backtrace of current thread and aborts program.

We need to update it to print backtrace of all threads, not just current one.

It can be achieved by sending some signal (e.g. SIGQUIT) to all threads, which will cause each thread to print its backtrace and terminate. And then exiting after all threads are terminated.

Backtrace of original failed thread should be marked somehow to indicate that it was the source of the problem.