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 1uewHC-00GvLo-8n for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Jul 2025 13:46:26 +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 1uewHB-0089Gc-9p for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Jul 2025 13:46:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uewHB-0089GT-1F for pgsql-bugs@lists.postgresql.org; Thu, 24 Jul 2025 13:46:25 +0000 Received: from mail-gateway-shared11.cyon.net ([194.126.200.64]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uewH9-000YmC-0R for pgsql-bugs@lists.postgresql.org; Thu, 24 Jul 2025 13:46:24 +0000 Received: from s062.cyon.net ([149.126.4.71]) by mail-gateway-shared11.cyon.net with esmtpsa (TLS1.2:ECDHE_SECP256R1__RSA_SHA512__AES_256_GCM:256) (Exim) (envelope-from ) id 1uewH4-00FLsN-1L for pgsql-bugs@lists.postgresql.org; Thu, 24 Jul 2025 15:46:20 +0200 Received: from [10.20.10.51] (port=7674 helo=mail.cyon.ch) by s062.cyon.net with esmtpa (Exim 4.98.1) (envelope-from ) id 1uewGz-0000000ARZf-1EfG; Thu, 24 Jul 2025 15:46:13 +0200 Content-Type: multipart/mixed; boundary="------------0yARVRBx4LjR3NI05nLaT09k" Message-ID: <32f9406b-d3c7-4dd4-9027-d72c116d199d@packi.ch> Date: Thu, 24 Jul 2025 15:46:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18996: Assertion fails in waiteventset.c when dropping database in single mode in PG18 To: pgsql-bugs@lists.postgresql.org References: <18996-3a2744c8140488de@postgresql.org> Content-Language: en-US From: =?UTF-8?Q?Patrick_St=C3=A4hlin?= Cc: Heikki Linnakangas In-Reply-To: <18996-3a2744c8140488de@postgresql.org> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - s062.cyon.net X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - packi.ch X-Get-Message-Sender-Via: s062.cyon.net: authenticated_id: me@packi.ch X-Authenticated-Sender: s062.cyon.net: me@packi.ch List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------0yARVRBx4LjR3NI05nLaT09k Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi! On 7/24/25 11:49 AM, PG Bug reporting form wrote: > > We're starting to incorporate PG18 (REL_18_BETA2) in our builds/testing. Our > tests currently fail because we drop the postgres database in single mode > before we give our customers access to them, as they won't have superuser > access and we allow them to re-create that database. It also triggers when I > create a database foo and then drop it so it's not related to the postgres > database specifically. The assert doesn't trigger with REL_17_5 built with > the same instructions. 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. I've attached a patch based on REL_18_STABLE that seems to fix the issue for us and passes the selftests. Thanks, Patrick --------------0yARVRBx4LjR3NI05nLaT09k Content-Type: text/x-patch; charset=UTF-8; name="0001-Do-not-modify-wait-events-we-never-added.patch" Content-Disposition: attachment; filename="0001-Do-not-modify-wait-events-we-never-added.patch" Content-Transfer-Encoding: base64 RnJvbSBmMzFlNWVmYjMzYTgyY2QyZmM2NDZ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