Closed tworonix closed 5 months ago
I was using quite old versions, but I don't think this was fixed in any newer releases of gcc or boost?
This doesn't really have much to do with boost, since the global lock in question comes from dl_iterate_phdr
glibc function, which unwinders invoke when doing their stuff.
However, starting from glibc2.35 and gcc-12.3/llvm-16.0.0 this is no longer the case (at least it shouldn't be): https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71744#c32 https://reviews.llvm.org/D130668
Adding more clarification in #156
As @itrofimow noted, there's not much we can do in Boost.Stacktrace.
Many thanks to all the participants! The docs are updated, changes will be in Boost 1.85
Steps to reproduce
timer_create
andSIGEV_SIGNAL
safe_dump_to
in the signal handlerActual behavior: The process deadlocks and hangs forever.
When investigating this issue I found out that throwing an exception in C++ involves locking a mutex (see here for more details: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2544r0.html )
Apparently both throwing the exception and collecting the stacktrace from the signal handler try to lock the same mutex. This leads to a deadlock, or possibly also other undefined behaviour.
Unfortunately this makes
safe_dump_to
not so safe to call from a signal handler, which I find very bad news. I wish there was a way to get it to work reliably. I was using quite old versions, but I don't think this was fixed in any newer releases of gcc or boost?Platform details
boost-1.66, Linux Intel x64, gcc-8.2.1, library compiled with BOOST_STACKTRACE_USE_ADDR2LINE
Output of gdb after loading the coredump of the deadlocked process