diff options
| author | virchau13 <virchau13@hexular.net> | 2024-04-28 00:38:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-27 17:38:48 +0100 |
| commit | 90a53aed59be6bac45c13eac954471d56ac23375 (patch) | |
| tree | c1a246f6cdf0b9f6d0f1f6ea6f282b4fa5666976 /src/Compositor.cpp | |
| parent | 55490637aaf13c8400a0679fcf5b7fca417bc923 (diff) | |
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.
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index c627fe72..17786cb2 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -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(); |
