From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: scratch/sigchld-fd 8f0ce42 1/2: Fix deadlock when receiving SIGCHLD during 'pselect'. Date: Wed, 20 Jan 2021 05:37:41 +0200 Message-ID: <83r1mg6zy2.fsf@gnu.org> References: <20210116184947.2105.45267@vcs0.savannah.gnu.org> <20210116184949.3C17C211A5@vcs0.savannah.gnu.org> <834kjd7yk5.fsf@gnu.org> <83turc7n93.fsf@gnu.org> <871regr6x5.fsf@igel.home> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31581"; mail-complaints-to="usenet@ciao.gmane.io" Cc: phst@google.com, p.stephani2@gmail.com, emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 20 04:47:44 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l24T9-00087G-TT for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Jan 2021 04:47:43 +0100 Original-Received: from localhost ([::1]:60114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l24T8-0002tQ-U4 for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jan 2021 22:47:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l24JI-0000jd-Jy for emacs-devel@gnu.org; Tue, 19 Jan 2021 22:37:32 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42017) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l24JH-000072-BN; Tue, 19 Jan 2021 22:37:31 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2058 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l24JG-00089i-O4; Tue, 19 Jan 2021 22:37:31 -0500 In-Reply-To: <871regr6x5.fsf@igel.home> (message from Andreas Schwab on Tue, 19 Jan 2021 21:46:46 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:263191 Archived-At: > From: Andreas Schwab > Cc: Philipp Stephani , phst@google.com, > emacs-devel@gnu.org > Date: Tue, 19 Jan 2021 21:46:46 +0100 > > On Jan 19 2021, Eli Zaretskii wrote: > > > I'd be happier if we had some direct evidence to these effects. I'd > > also be surprised to hear that pselect doesn't return with EINTR when > > SIGCHLD comes in. It is more likely that SIGCHLD is delivered before > > we call pselect, but if that is the case, we should be able to > > reliably detect that, I think. > > If you want reliable detection of SIGCHLD, you need to block the signal > around pselect and let pselect unblock it, atomically. AFAIU, this is an issue for programs that install a SIGCHLD handler immediately before calling pselect. But Emacs has a SIGCHLD handler installed at all times, so if the signal hits outside of the pselect call, we should be able to detect that reliably.