X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AED733858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1673284431; bh=W50hWGMNfd2oD62aVDAKAjq6GkyC0ZuUHgAoeuoa9fs=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RNh1nHj8vVaJaVcN4OLiAseVTxLx54JHllSDxcbpyaI1D31CENONhCSXPnAH/7H0b ng7GfW+Szcc6UA/KtVc+5bPLT0xddV6FKff/eeRHbAcNiRQzLEuZMX3VKRvjFj88D4 qlFNrkB48AoWF+Pmp6m7+8EgSnf/KrKutQbN29F4= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com Date: Mon, 9 Jan 2023 18:13:26 +0100 To: cygwin AT cygwin DOT com Subject: Re: Cygwin 3.4.3 and 3.5.0... hangs in make, top, procps, ls /proc/PID/... Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com, Takashi Yano References: <4a4427cc-422b-1d14-015e-26523e620d9b AT Shaw DOT ca> <20230102113201 DOT 476c10bef7a5643bddc00762 AT nifty DOT ne DOT jp> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230102113201.476c10bef7a5643bddc00762@nifty.ne.jp> X-Provags-ID: V03:K1:NX2XH6Z1x2PYJGwqE/rp2DC4b9OsvPrPAB7AbH0EC9aj9Wk+ZcD PZC9GP9w22UyJaGvqu6XlvGG14DW+bqT/pVdrdP+BzsICknKoe6xfvVt8it/uaNAZ5Mq/PR MvOw9MiWYSL0X7YRoRfzZVnukaFXEbCfmt3rlHsDgZB2RIEhxd7HEYEk9dcsv6fN4JBEdAt gGyL07Wtpx7XI8iJ0k15g== UI-OutboundReport: notjunk:1;M01:P0:qR7dIedXOKU=;+6yc8Umd5SDWaxMiWwblGmgQoG+ bGwNiarLtTpyTRRCcGeBhG0pWPavr8a0hivDRCUdZrubL+bGv57SI8YaikKDdL+yzKJQzXAmO 0TqLc573leGsJO4pgcbmpU9/Lc89P74shyJlQuUsj4NbfK2AZa3gyKdE/Q3oVErmBzVYsH9jS 8DDLD16JDaXff9ZXmhf9qN/SbezcdvYAg77VTujiNBfEAAQrBnsN+4rZTAa133hTC/oV5+5Sq 3sEthre4DC+lFnoD+Y7IcySYUdORp4SbcMg/SzuZOji7aXz2z7gXjnOjZ/NFYhUQ5Nz8faq6d NMPm21kEQ4KU+7m4rJxe9VPai+QkI4qmSGGrgx2U5M3Pa5VrWvS6U/0fRGTBkt4NNnqDEawVQ pqz22IkwyQfVAwn1lZrf/Ns3IGITcDrZP9SGEOypgmHJgx3CmttLsuZZvUlJbtoBTrljvsDNn KsyZdRcakYlyXRtOPLonM7zZmLWsFkb7X9rGlY4LJgd6t79HJfQEIcDIjAeK5H2YyG4MYRUAY jJxxLnMJOy8JPDkJ0UWzcUyOhYxf8+96E5Zh9okzWuboulSY6lCGuNF6Wsgs8+VhT0Le/Tr2z o5hm0JZrAqpKE23/sdjNnx7jOWTKEoaggvLylfKIlxBxabSFLPe04491j23jRQm/zE/vlLOMv SIGJeuiEuXY2UzqxnT9MK/eHqlGtYclS2SpkNPs9mA== X-Spam-Status: No, score=-102.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_FAIL, SPF_HELO_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen , Takashi Yano Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple