From d5a1a376773432f535c20bf7b2a8512028a09b05 Mon Sep 17 00:00:00 2001 From: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> Date: Sat, 11 Oct 2025 13:26:33 +0300 Subject: [PATCH] fix(status-file): prevent deadlock on Windows by commenting out non-async-safe code --- src/daemon/status-file.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/daemon/status-file.c b/src/daemon/status-file.c index df11557db441b9..71fd241f5d6888 100644 --- a/src/daemon/status-file.c +++ b/src/daemon/status-file.c @@ -1495,6 +1495,11 @@ bool daemon_status_file_deadly_signal_received(EXIT_REASON reason, SIGNAL_CODE c } #ifdef HAVE_LIBBACKTRACE +#if defined(OS_WINDOWS) + // THE FOLLOWING CODE IS NOT ASYNC-SIGNAL-SAFE on MSYS2 due to internal locking in the runtime. + // This can cause a deadlock when a signal is received while the lock is held. + // The code is commented out to prevent the deadlock, at the cost of not saving the status file on a crash. +#else bool safe_to_get_stack_trace = reason != EXIT_REASON_SIGABRT || stacktrace_capture_is_async_signal_safe(); bool get_stack_trace = stacktrace_available() && safe_to_get_stack_trace && stack_trace_is_empty(&session_status); @@ -1509,7 +1514,8 @@ bool daemon_status_file_deadly_signal_received(EXIT_REASON reason, SIGNAL_CODE c daemon_status_file_save(static_save_buffer, &session_status, false); } -#endif +#endif // defined(OS_WINDOWS) +#endif // HAVE_LIBBACKTRACE return duplicate; }