-
Notifications
You must be signed in to change notification settings - Fork 76
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
safe_dump_to causes a deadlock if signal is received when throwing an exception #131
Comments
This doesn't really have much to do with boost, since the global lock in question comes from 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): |
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
The text was updated successfully, but these errors were encountered: