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 1k5Dfx-0004mh-9M for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Aug 2020 19:41:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k5Dfw-0005dw-6A for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Aug 2020 19:41:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Dfv-0005do-VP for pgsql-hackers@lists.postgresql.org; Mon, 10 Aug 2020 19:41:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Dft-0004sE-Np for pgsql-hackers@lists.postgresql.org; Mon, 10 Aug 2020 19:41:39 +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 07AJfXuW3250876; Mon, 10 Aug 2020 15:41:33 -0400 From: Tom Lane To: Robert Haas cc: Andres Freund , Bharath Rupireddy , PostgreSQL Hackers Subject: Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks In-reply-to: References: <1519052.1594129481@sss.pgh.pa.us> <20200707165445.6qniqhzydlfsplvw@alap3.anarazel.de> <20200807212022.wocdoo2mmzhjsjm3@alap3.anarazel.de> <3195298.1597070661@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 10 Aug 2020 15:33:15 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3250874.1597088493.1@sss.pgh.pa.us> Date: Mon, 10 Aug 2020 15:41:33 -0400 Message-ID: <3250875.1597088493@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > Perhaps we really have four categories here: > (1) Temporary handlers for PG_ENSURE_ERROR_CLEANUP(). > (2) High-level cleanup that needs to run after aborting out of the > current transaction. > (3) Per-subsystem shutdown for shared memory stuff. > (4) Per-subsystem shutdown for backend-private stuff. Hmm, I don't think we actually have any of (2) do we? Or at least we aren't using ipc.c callbacks for them. > What I do think we should do, after thinking about it more, > is discourage the casual use of before_shmem_exit() for things where > on_shmem_exit() or on_proc_exit() would be just as good. I think > that's what would avoid the most problems here. I think we're mostly in violent agreement here. The interesting question seems to be Andres' one about whether before_shmem_exit actually has any safe use except for PG_ENSURE_ERROR_CLEANUP. It may not, in which case perhaps we oughta rename it? regards, tom lane