Skip to content

Commit 9844cdf

Browse files
authored
Skip status file on windows on crash (#21140)
fix(status-file): prevent deadlock on Windows by commenting out non-async-safe code
1 parent b3e6465 commit 9844cdf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/daemon/status-file.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,11 @@ bool daemon_status_file_deadly_signal_received(EXIT_REASON reason, SIGNAL_CODE c
14951495
}
14961496

14971497
#ifdef HAVE_LIBBACKTRACE
1498+
#if defined(OS_WINDOWS)
1499+
// THE FOLLOWING CODE IS NOT ASYNC-SIGNAL-SAFE on MSYS2 due to internal locking in the runtime.
1500+
// This can cause a deadlock when a signal is received while the lock is held.
1501+
// The code is commented out to prevent the deadlock, at the cost of not saving the status file on a crash.
1502+
#else
14981503
bool safe_to_get_stack_trace = reason != EXIT_REASON_SIGABRT || stacktrace_capture_is_async_signal_safe();
14991504
bool get_stack_trace = stacktrace_available() && safe_to_get_stack_trace && stack_trace_is_empty(&session_status);
15001505

@@ -1509,7 +1514,8 @@ bool daemon_status_file_deadly_signal_received(EXIT_REASON reason, SIGNAL_CODE c
15091514

15101515
daemon_status_file_save(static_save_buffer, &session_status, false);
15111516
}
1512-
#endif
1517+
#endif // defined(OS_WINDOWS)
1518+
#endif // HAVE_LIBBACKTRACE
15131519

15141520
return duplicate;
15151521
}

0 commit comments

Comments
 (0)