public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Cc: Takashi Yano <takashi.yano@nifty.ne.jp>
Subject: Re: Cygwin 3.4.3 and 3.5.0... hangs in make, top, procps, ls /proc/PID/...
Date: Mon, 9 Jan 2023 18:13:26 +0100	[thread overview]
Message-ID: <Y7xLNqMa8zdIkRfj@calimero.vinschen.de> (raw)
In-Reply-To: <20230102113201.476c10bef7a5643bddc00762@nifty.ne.jp>

On Jan  2 11:32, Takashi Yano via Cygwin wrote:
> On Thu, 29 Dec 2022 21:59:45 -0700
> Brian Inglis wrote:
> > I got some hangs (deadlock?) between (parallel?) make jobs, top, procps, and 
> > even ls /proc/*/ when trying to cygport all check curl or look at the process 
> > statuses when builds hung under Cygwin 3.4.3 and 3.5.0-0.69...
> > [...]
> I have looked into this issue a bit, and found that
> q->sigtls becomes sometimes NULL and access violation
> occurs at the following code.
> 
> winsup/cygwin/sigproc.cc: 1378
> 		if (q->sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
> 		  {
> 		    tl_entry = cygheap->find_tls (q->si.si_signo, issig_wait);
> 
> I'm not sure why this happens, however it seems that
> the following patch fixes the issue.
> 
> diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
> index ce36c8be3..90eaa2a47 100644
> --- a/winsup/cygwin/sigproc.cc
> +++ b/winsup/cygwin/sigproc.cc
> @@ -1375,6 +1375,8 @@ wait_sig (VOID *)
>  	    *pack.mask = 0;
>  	    while ((q = q->next))
>  	      {
> +		if (q->sigtls == NULL)
> +		  continue;
>  		if (q->sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
>  		  {
>  		    tl_entry = cygheap->find_tls (q->si.si_signo, issig_wait);
> 
> Corinna, could you please have a look?

If q->sigtls is NULL, the signal is nevertheless waiting for being
handled.  It's just not directed at a specific thread.  Beats me, why
this didn't occur in my testing.  The process signal info should contain
the process-wide mask of pending signals as well, obviously, so the
following patch should do the right thing:

diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index ce36c8be37fb..86e4e607ab7e 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -1375,7 +1375,8 @@ wait_sig (VOID *)
 	    *pack.mask = 0;
 	    while ((q = q->next))
 	      {
-		if (q->sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
+		_cygtls *sigtls = q->sigtls ?: _main_tls;
+		if (sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
 		  {
 		    tl_entry = cygheap->find_tls (q->si.si_signo, issig_wait);
 		    if (tl_entry)

Can you confirm?


Thanks,
Corinna

  parent reply	other threads:[~2023-01-09 17:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30  4:59 Brian Inglis
2023-01-02  2:32 ` Takashi Yano
2023-01-02  5:38   ` Takashi Yano
2023-01-02  8:21     ` Takashi Yano
2023-01-09 13:20       ` Corinna Vinschen
2023-01-16  9:02         ` Takashi Yano
2023-01-16 10:23           ` Corinna Vinschen
2023-01-16 14:45             ` Takashi Yano
2023-01-16 15:18               ` Corinna Vinschen
2023-01-16 19:23                 ` Brian Inglis
2023-01-16 21:42                 ` Corinna Vinschen
2023-01-17 20:46                   ` Corinna Vinschen
2023-01-18  9:16                     ` Takashi Yano
2023-01-18  9:42                       ` Corinna Vinschen
2023-01-19 16:31                         ` Brian Inglis
2023-01-19 17:12                           ` Brian Inglis
2023-01-19 18:38                           ` Corinna Vinschen
2023-01-19 18:42                             ` Jose Isaias Cabrera
2023-01-19 19:31                             ` Brian Inglis
2023-03-21 19:17                               ` Brian Inglis
2023-03-22 19:05                                 ` Brian Inglis
2023-01-02 23:03   ` Takashi Yano
2023-01-09 16:02     ` Corinna Vinschen
2023-01-09 17:13   ` Corinna Vinschen [this message]
2023-01-10 10:01     ` Takashi Yano
2023-01-10 10:57       ` Corinna Vinschen
2023-01-09 13:36 ` Corinna Vinschen
2023-01-10  0:00   ` Brian Inglis
2023-01-16 15:40     ` Jon Turney
2023-01-16 18:54       ` Brian Inglis
2022-12-31 20:01 Brian Inglis
2023-01-01 18:51 ` Jeremy Drake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y7xLNqMa8zdIkRfj@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    --cc=takashi.yano@nifty.ne.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).