Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r8Pj8-009k30-D8 for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Nov 2023 18:56:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r8Pj7-00CTeL-5A for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Nov 2023 18:56:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r8Pj6-00CTeC-Rf for pgsql-hackers@lists.postgresql.org; Wed, 29 Nov 2023 18:56:00 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r8Pj4-009DOG-LE for pgsql-hackers@postgresql.org; Wed, 29 Nov 2023 18:56:00 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6A3A65C023B; Wed, 29 Nov 2023 13:55:57 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 29 Nov 2023 13:55:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1701284157; x=1701370557; bh=YU /ZxGsxBI5TdswCj/NxWexasob5QP/RsHL7vJheZFE=; b=MYGt1rLWl0qpd96cGd oeiJAjWkTH6ffkDSe900ZykPLIFocRgf1ebWn3Sxe9VZtIeM6og7tqor99PRyPpG 5B7LNMxKPTA9BHxhYBmc7JV46RlpSu1LikT9OAISAYHhlrDPAGFMaVyn15ciHEfW +xEbnTNX/rjPkFRa6jQB2g4Y1Q36pXbMu+GppJlRHWg0PYg+jhKsbrrS+ppIvk3e rmKc0fNz1bcD2b6QIN9DgNe06a9PHA0k8/AoQC/VU1hCNnG0pSAkPPItm3jT6RHs shXZwnr2zMmszfvg3hcy/L+42hduVo8QoZUSQs04hbEWqH0VEonq9ngQbCQhIAnn 4R5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701284157; x=1701370557; bh=YU/ZxGsxBI5Td swCj/NxWexasob5QP/RsHL7vJheZFE=; b=MdLqEgJ1zznJbPzvlvbhqgBXV0UZ5 eyARi1YbmFtUy5uAd2Kl1cnj0N0zSupomhRGdECm6mq3CZWSmoQ10vkRUMDG4zSl QtOsb+3qi4kYKtQ9wrpevIWbtS7lwv3kT28pTr19pLT+KUnHVb0Zw++dsM2cqmWF KQ0fwSkhQV3yjBkDF1v8tvRni2em2TS5ktFKem1jV4ZdqmREZKv+wnWMwglsr7qo qCHCVxURIe4oEXo9mt8/wW/A0mk624vpjbqZU878XFopIvIJE0Go6NHFSZjgyWFj GArTxoTg5uu8DYIBaA3uHVqnKAihoGc3Qa5aTaygdvUtvenevc1QJ7PTw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeihedguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 29 Nov 2023 13:55:56 -0500 (EST) Date: Wed, 29 Nov 2023 10:55:55 -0800 From: Andres Freund To: Nathan Bossart Cc: David Geier , PostgreSQL-development Subject: Re: Fix assertion in autovacuum worker Message-ID: <20231129185555.tnr3noi7qcjqqiw2@awork3.anarazel.de> References: <20231128220516.GA475168@nathanxps13> <20231129000349.pcfvrewvqk4he6i2@awork3.anarazel.de> <20231129024247.GA479372@nathanxps13> <20231129024859.kajlgqg33dksonbi@awork3.anarazel.de> <20231129175201.GA902323@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231129175201.GA902323@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-11-29 11:52:01 -0600, Nathan Bossart wrote: > On Tue, Nov 28, 2023 at 06:48:59PM -0800, Andres Freund wrote: > > On 2023-11-28 20:42:47 -0600, Nathan Bossart wrote: > >> Right. Perhaps we could add a LWLockReleaseAll() to > >> pgstat_shutdown_hook() instead of the autovacuum code, but I'm afraid that > >> is still just a hack. > > > > Yea, we'd need that in just about all before_shmem_exit() callbacks. I could > > see an argument for doing it in proc_exit_prepare(). While that'd be a fairly > > gross layering violation, we already do reset a number a bunch of stuff in > > there: > > Gross layering violations aside, that at least seems more future-proof > against other sigsetjmp() blocks that proc_exit() without doing any > preliminary cleanup. It's not just sigsetjmp() blocks not doing cleanup that are problematic - consider what happens if there's either no sigsetjmp() block established (and thus ERROR is promoted to FATAL), or if a FATAL error is raised. Then cleanup in the sigsetjmp() site doesn't matter. So we really need a better answer here. If we don't want to add LWLockReleaseAll() to proc_exit_prepare(), ISTM we should all at least add some assertion infrastructure verifying it's being called in relevant paths, triggering an assertion if there was no LWLockReleaseAll() before reaching important before_shmem_exit() routines, even if we don't actually hold an lwlock at the time of the error. Otherwise problematic paths are way too hard to find. Greetings, Andres Freund