Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDHOY-0001mb-Tk for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Oct 2018 23:07:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gDHOW-0006e9-Ps for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Oct 2018 23:07:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDHOW-0006e2-Ei for pgsql-bugs@lists.postgresql.org; Thu, 18 Oct 2018 23:07:56 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDHOP-0005SU-Kz for pgsql-bugs@postgresql.org; Thu, 18 Oct 2018 23:07:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w9IN7iNo031091; Thu, 18 Oct 2018 19:07:44 -0400 From: Tom Lane To: Andres Freund cc: Andrey , Jeff Janes , Pg Bugs Subject: Re: NOTIFY does not work as expected In-reply-to: <20181018224608.6d4v2fadyu3vrbx2@alap3.anarazel.de> References: <64711.1530595730@sss.pgh.pa.us> <20180704183055.hqlqm3ramerybzvd@alap3.anarazel.de> <29914.1539902374@sss.pgh.pa.us> <20181018224608.6d4v2fadyu3vrbx2@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 18 Oct 2018 15:46:08 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31089.1539904064.1@sss.pgh.pa.us> Date: Thu, 18 Oct 2018 19:07:44 -0400 Message-ID: <31090.1539904064@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-10-18 18:39:34 -0400, Tom Lane wrote: >> 2. I don't believe the "blocked" vs "not-blocked" distinction one bit. >> At best, it creates race-condition-like changes in behavior depending >> on exactly when a signal arrives vs when data arrives or is sent. >> At worst, I think it creates the same problem it's purporting to solve, >> ie failure to respond to ProcDiePending at all. I think the >> before/during/after calls to ProcessClientXXXInterrupt should just all >> behave the same and always be willing to execute ProcDiePending. > That distinction was introduced because people (IIRC you actually) were > worried that we'd be less likely to get error messages out to the > client. Especially when you check unconditionally before actually doing > the write, it's going to be far less likely that we are able to send > something out to the client. Far less likely than what? If we got a ProcDie signal we'd more often than not have handled it long before reaching here. If we hadn't, though, we could arrive here with ProcDiePending set but the latch clear, in which case we fail to honor the interrupt until the client does something. Don't really think that's acceptable :-(. I'm also not seeing why it's okay to commit ProcDie hara-kiri immediately if the socket is write-blocked but not otherwise --- the two cases are going to look about the same from the client side. regards, tom lane