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 1uf6oX-002EO3-DJ for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Jul 2025 01:01:34 +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 1uf6oV-00D969-45 for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Jul 2025 01:01:31 +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 1uf6oU-00D961-RH for pgsql-bugs@lists.postgresql.org; Fri, 25 Jul 2025 01:01:31 +0000 Received: from fhigh-a1-smtp.messagingengine.com ([103.168.172.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uf6oR-000h9O-0b for pgsql-bugs@lists.postgresql.org; Fri, 25 Jul 2025 01:01:30 +0000 Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6A0D914000C9; Thu, 24 Jul 2025 21:01:26 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 24 Jul 2025 21:01:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1753405286; x=1753491686; bh=SLi3EITgzP 5iL3hBxM4G4zNf4GoOJwQhRAC2itVgUMg=; b=SdNf4gccb429hHQQC6qtM2S9vS 7wBTOjRdjpowdyQ+S8Ufv2zPMKU5dTcHQfPFvUaykOBzfGk+3ydHpqculNqpctsL IECgutlKLcrMZpUBMgu4k/zOCoXfMdnY35h1J/ZPN5nE2bp4mriZ0yxTB/WUkwdm m2XXgL7S5Z75ubD8S6jKX5cVwj4TX9GScRJMWE/WNpu8KyUiPSVbr6xAS2MZjCNq VSKkNop5yObEgICNeZhvVm/lWmbZW7ststGxb9Zpa6pdVYZL3xmHsqXRRf5HrinZ B7Mcmxev1qSVyp1cfvjhrjDR7dbG3jZjOPN/xqUTriH2TaBCiiMzR7rJaBcA== 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:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1753405286; x=1753491686; bh=SLi3EITgzP5iL3hBxM4G4zNf4GoOJwQhRAC 2itVgUMg=; b=d0rPnS6O5z5yhyMd+QIGRTqJTfpENoRH0PMr1zf0LuGerZzlWQM Z1buyFJ+q1xBr2FW9V/F8JIQvEbvSlRKyZ1ljpGV07XTdsU+BXWj0Wqu5YUZf7MW 9ThToxYP6Qt6yPICIVvayt5hfv21h8FTUQA8VIntW23yl+cCCNr7S3EhHHSBKPuB nU+s6Q3iVgxc/i35Dg4SxMdVOnb98NUH5krYKSIUU9PINr6q26Dw403y/ipgGZOv dQAVcgIwhSmwOjGuzqrxvbOTo0/m9RopP0t565eIMRSu4IWI3KTqJyUtoqKd9FDc JIJK+cZTC+BCMY+xfzapGR3L0D5SvfAFDtA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdekvdduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtuden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpefgheehgfdufedugfefleegieffgeef hfekfeffvdehfedutdehteegleetveekteenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehmvgesph grtghkihdrtghhpdhrtghpthhtohepphhgshhqlhdqsghughhssehlihhsthhsrdhpohhs thhgrhgvshhqlhdrohhrghdprhgtphhtthhopehhvghikhhkihdrlhhinhhnrghkrghngh grshesihhkihdrfhhi X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Jul 2025 21:01:23 -0400 (EDT) Date: Fri, 25 Jul 2025 10:01:11 +0900 From: Michael Paquier To: Patrick =?iso-8859-1?Q?St=E4hlin?= Cc: pgsql-bugs@lists.postgresql.org, Heikki Linnakangas Subject: Re: BUG #18996: Assertion fails in waiteventset.c when dropping database in single mode in PG18 Message-ID: References: <18996-3a2744c8140488de@postgresql.org> <32f9406b-d3c7-4dd4-9027-d72c116d199d@packi.ch> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JiicBFZw2KAbNtAK" Content-Disposition: inline In-Reply-To: <32f9406b-d3c7-4dd4-9027-d72c116d199d@packi.ch> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --JiicBFZw2KAbNtAK Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 24, 2025 at 03:46:12PM +0200, Patrick St=E4hlin wrote: > We, or rather git bisect, traced it down to commit > 84e5b2f07a5e8ba983ff0f6e71b063b27f45f346 that added a new wait event in > InitializeLatchWaitSet if we're running under postmaster but then didn't = add > the same check in WaitLatch and always referenced it. This probably caused > the assert later on, when we were waiting on the ProcBarrier. >=20 > I've attached a patch based on REL_18_STABLE that seems to fix the issue = for > us and passes the selftests. That's the same kind of single-user-mode shortcut we have in the past for similar issues, like 0ce5cf2ef24f for example. @@ -187,9 +187,10 @@ WaitLatch(Latch *latch, int wakeEvents, long timeout, if (!(wakeEvents & WL_LATCH_SET)) latch =3D NULL; ModifyWaitEvent(LatchWaitSet, LatchWaitSetLatchPos, WL_LATCH_SET, latc= h); - ModifyWaitEvent(LatchWaitSet, LatchWaitSetPostmasterDeathPos, - (wakeEvents & (WL_EXIT_ON_PM_DEATH | WL_POSTMASTER_DEA= TH)), - NULL); + if (IsUnderPostmaster) + ModifyWaitEvent(LatchWaitSet, LatchWaitSetPostmasterDeathPos, + (wakeEvents & (WL_EXIT_ON_PM_DEATH | WL_POSTMASTER= _DEATH)), + NULL); Yeah, that looks good to me. It does not make sense to rely on that for !IsUnderPostmaster, which is something that we obviously support in WaitLatch() based on the assertion a couple of lines above while the initialization happens. Will fix, thanks for the report! -- Michael --JiicBFZw2KAbNtAK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmiC11cACgkQnvQgOdby QH3ong/9GBXiQwrHq5HfHNxrxLAq7U+Qh+9WEWMiWZsm+l3Lm1VHli7iRpfBXjtM TTysmH76/AnqJACnJ0deY3AVYiaNv5GK3o133l1CIhBlUFIvlu9a39WA//qLqVJv aREghUvkHgJc4mUH4ncIpkscJAALX7mbsAFXxXZHHgrL4UnnS+2TqvkdROz0aIFP rsqyjnSAtGGVF68Q4vx7s/jmC6t0Ox3jfalOFj/rQ5fRQRLhTYizNuOPEsqoLqtV Zxf6V6j3B0VDD92Nmpi1wPYVeQuBKGJSPebTrpIMR1+uyyotzupdrnSWmEGErhD2 n2LLuS0Y4FqmYPRnJMZD1w2AIp2UKNq5Jk5sOEfeZ4BFY8cPn4R13q5hGCLWhdQG WHk8ri+PtGTZqm1G2ViLXneMTZmg8BpuRrobztmTECzcuHZ6YlESebSz6AEZufRI XHNai1ZmxE3KKUq7KwT0LXC4UfvILObk9NTE2uBWqr9oQSBaumTk6J4x84nWysU3 SSAdf6YUut6SJxQ5vy9VYUmIHMRLnx1mIQmYiiYyx3gl8zlfGbqO4jIIsWwrTbgQ jpIt/wRfGiHm4Fz3cASczyU/bg0xsJq2Gma0j0Lf3uq72/8R0M26zN0JJlm0FMuA fmbvHSW3IBOxx8W8domMvQcU6130My2UZjl0EC4x91qrge5bgjA= =Opzr -----END PGP SIGNATURE----- --JiicBFZw2KAbNtAK--