[PATCH v2 3/3] Cygwin: signal: Fix a problem that process hangs on exit
Takashi Yano
takashi.yano@nifty.ne.jp
Fri Feb 28 23:08:44 GMT 2025
The process that receives many SIGSTOP/SIGCONT signals sometimes hangs
on exit in sig_dispatch_pending(). This patch skips processing signals
in wait_sig() when exit_state > ES_EXIT_STARTING to avoid that situation.
Addresses: https://cygwin.com/pipermail/cygwin/2025-February/257473.html
Fixes: d243e51ef1d3 ("Cygwin: signal: Fix deadlock between main thread and sig thread")
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Reviewed-by:
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
---
winsup/cygwin/sigproc.cc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 8739f18f5..b519866d2 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1374,7 +1374,11 @@ wait_sig (VOID *)
sigq.retry = false;
/* Don't process signals when we start exiting */
- if (exit_state > ES_EXIT_STARTING && pack.si.si_signo > 0)
+ if (exit_state > ES_EXIT_STARTING
+ && (pack.si.si_signo > 0
+ || pack.si.si_signo == __SIGNOHOLD
+ || pack.si.si_signo == __SIGFLUSH
+ || pack.si.si_signo == __SIGFLUSHFAST))
goto skip_process_signal;
sigset_t dummy_mask;
--
2.45.1
More information about the Cygwin-patches
mailing list