mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-10 09:01:55 -07:00
CrashReporter: fix deadlocks by making it mostly async-signal-safe (#5771)
`CrashReporter::createAndSaveCrash()` is not async-signal-safe, resulting in random deadlocks/double-crashes during Hyprland crashes. This changes the function to be (mostly) async-signal-safe.
This commit is contained in:
@@ -36,6 +36,14 @@ void handleUnrecoverableSignal(int sig) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Kill the program if the crash-reporter is caught in a deadlock.
|
||||
signal(SIGALRM, [](int _) {
|
||||
char const* msg = "\nCrashReporter exceeded timeout, forcefully exiting\n";
|
||||
write(2, msg, strlen(msg));
|
||||
abort();
|
||||
});
|
||||
alarm(15);
|
||||
|
||||
CrashReporter::createAndSaveCrash(sig);
|
||||
|
||||
abort();
|
||||
|
Reference in New Issue
Block a user