Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSpyu-0004ov-83 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Oct 2020 23:14:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kSpys-0001ZW-3K for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Oct 2020 23:14:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSpyr-0001Up-Pg for pgsql-hackers@lists.postgresql.org; Wed, 14 Oct 2020 23:14:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSpyp-0002RF-IB for pgsql-hackers@lists.postgresql.org; Wed, 14 Oct 2020 23:14:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 09ENEZmU3638495; Wed, 14 Oct 2020 19:14:35 -0400 From: Tom Lane To: Andres Freund cc: Thomas Munro , Heikki Linnakangas , PostgreSQL Hackers Subject: Re: kevent latch paths don't handle postmaster death well In-reply-to: <20201014225942.oya7ncon63ltwrnq@alap3.anarazel.de> References: <3624029.1602701929@sss.pgh.pa.us> <3625898.1602704431@sss.pgh.pa.us> <20201014225942.oya7ncon63ltwrnq@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Wed, 14 Oct 2020 15:59:42 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3638493.1602717275.1@sss.pgh.pa.us> Date: Wed, 14 Oct 2020 19:14:35 -0400 Message-ID: <3638494.1602717275@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2020-10-15 11:10:28 +1300, Thomas Munro wrote: >> I don't think that's a problem -- the kernel will report the event to >> each interested kqueue object. The attached fixes the problem for me. > Will it do so even if the kqueue is created after postmaster death? I did not try to test it, but there's code that purports to handle that in latch.c, ~ line 1150, and the behavior it's expecting mostly agrees with what I read in the macOS kevent man page. One thing I'd suggest is that EACCES probably needs to be treated as "postmaster already dead", too, in case the PID is now owned by another user ID. regards, tom lane