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 19:03:14 +0200 Message-ID: <83ft2v7d7x.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> <83r1mg6zy2.fsf@gnu.org> <87pn20vwac.fsf@igel.home> <504E9D30-9AB0-4AF7-A128-66AB17983B67@gnu.org> <87lfcovuec.fsf@igel.home> <5638F98B-832B-456A-89F6-559DFB43BBAD@gnu.org> <87czxzx68b.fsf@igel.home> <83k0s77hhu.fsf@gnu.org> <87sg6vvcbo.fsf@igel.home> <83h7nb7e9f.fsf@gnu.org> <87o8hjv9pw.fsf@igel.home> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22530"; 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 18:07:23 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 1l2Gx0-0005mo-S0 for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Jan 2021 18:07:22 +0100 Original-Received: from localhost ([::1]:56680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2Gwz-0003KG-Pd for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Jan 2021 12:07:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2Gsq-0000NJ-UO for emacs-devel@gnu.org; Wed, 20 Jan 2021 12:03:13 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54450) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2Gso-0002s3-Qu; Wed, 20 Jan 2021 12:03:03 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3880 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l2Gsn-0006PS-Rc; Wed, 20 Jan 2021 12:03:02 -0500 In-Reply-To: <87o8hjv9pw.fsf@igel.home> (message from Andreas Schwab on Wed, 20 Jan 2021 17:44:59 +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:263214 Archived-At: > From: Andreas Schwab > Cc: emacs-devel@gnu.org, phst@google.com, p.stephani2@gmail.com > Date: Wed, 20 Jan 2021 17:44:59 +0100 > > >> You cannot do that. That creates races all over the place. > > > > What kind of races, and where in our code? please elaborate. > > The signal can occur anytime. When it interrupts the setup of the > pselect call, chaos will ensure. The only way to avoid that is to block > the signal around the call. What I described would be in the signal handler. > Doing anything non-trivial in a signal handler is bound to problems. Yes, I know. I think resetting a bit in a variable is more trivial than, say, writing to a pipe, something that we do now.