@cryptotaxi247 / netdata / commits / 9844cdf1c

Skip status file on windows on crash (#21140)

fix(status-file): prevent deadlock on Windows by commenting out non-async-safe code

Stelios Fragkakis committed Oct 13, 2025 at 21:18 UTC 9844cdf1c19e9f3b342c4d133fe5dbf49f88999e
1 file changed +7 -1
src/daemon/status-file.c
+7 -1
@@ -1495,6 +1495,11 @@ bool daemon_status_file_deadly_signal_received(EXIT_REASON reason, SIGNAL_CODE c
1495 }
1496
1497 #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
1503 bool safe_to_get_stack_trace = reason != EXIT_REASON_SIGABRT || stacktrace_capture_is_async_signal_safe();
1504 bool get_stack_trace = stacktrace_available() && safe_to_get_stack_trace && stack_trace_is_empty(&session_status);
1505
@@ -1509,7 +1514,8 @@ bool daemon_status_file_deadly_signal_received(EXIT_REASON reason, SIGNAL_CODE c
1514
1515 daemon_status_file_save(static_save_buffer, &session_status, false);
1516 }
1512 -#endif
1517 +#endif // defined(OS_WINDOWS)
1518 +#endif // HAVE_LIBBACKTRACE
1519
1520 return duplicate;
1521 }