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 1sF4zV-006hEw-9v for pgsql-bugs@arkaria.postgresql.org; Thu, 06 Jun 2024 04:44:46 +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 1sF4zU-00F2SQ-D8 for pgsql-bugs@arkaria.postgresql.org; Thu, 06 Jun 2024 04:44:44 +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 1sF4zU-00F2SI-4m for pgsql-bugs@lists.postgresql.org; Thu, 06 Jun 2024 04:44:44 +0000 Received: from wfhigh8-smtp.messagingengine.com ([64.147.123.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sF4zR-000ERG-L4 for pgsql-bugs@lists.postgresql.org; Thu, 06 Jun 2024 04:44:43 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.west.internal (Postfix) with ESMTP id EB8BC1800185; Thu, 6 Jun 2024 00:44:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 06 Jun 2024 00:44:39 -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=fm1; t=1717649078; x=1717735478; bh=uTiWv8x9D5 qr7Qu6cLnF4HgV5jgqIHFlsQiWIox4bj4=; b=iKtOfXgjaspy/3t0d7qrYOutba U8KfrVP2gd3s4I11rF5pFLvOGcBEz9xc67ly8/qVkCVoNfAn5geYOXba3kcBHNcF XkVA0ih2KZo9tKv6iOxmGcMasRVkJKb/+QBh4nDARNjilZQZBtVhEqWmTeh0hPA8 VsHiltjTFpIj6ppJwNDOlmUZt2mZOEqg7LRuBapDAKHGNg0rwvFV/FuRiJ92ydsE zKyQq01Y05l+q89k6QyEh3UdsACqAVjBwSzMeP2BUET+oVhCp3FMQz9HoY65RW2Q OoqPIxeCNsiTBSlyJswhm4fQ7FfoWMJCLKIbqVdbR5NwD/sLkihp+KMShqYw== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1717649078; x=1717735478; bh=uTiWv8x9D5qr7Qu6cLnF4HgV5jgq IHFlsQiWIox4bj4=; b=eViJTbxEdS91EWxPeGq61GB1LG4U5h3XQzy5x9x7g+7C riXAzl3aX/3pzx+yFUElcuLr5E4CMFpMlRej9ZKDW+AHLGx8gOQvmBJhL7w4zkMN /53wTGUwWCXbzR5QmxlLE7/VaoLjwUtuTKyyGSwVNXibZRsQJfvh2I6YkTH55Jx8 lDxcqZXtkyySB0bHACHx5/ms76SUl2ymPh4ZpMnIHoy/Ep6MEybUaQsbLQg+B971 oDyygWcsblgoOVbhimDfHTslypRG7ljkQP1zd/kQ0HOM5smeY/Vgp5bl7gxnXPhv M2fDd1TMvYy5JuqkBzcuKtLakQLSpIeNIXj6Q6Lbpg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeljedgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Jun 2024 00:44:36 -0400 (EDT) Date: Thu, 6 Jun 2024 13:44:26 +0900 From: Michael Paquier To: Floris Van Nee Cc: Andres Freund , Tom Lane , "pgsql-bugs@lists.postgresql.org" , Bertrand Drouvot Subject: Re: error "can only drop stats once" brings down database Message-ID: References: <215498.1708454947@sss.pgh.pa.us> <8e5cb534706a4f43bd74405c8fd91437@Optiver.com> <20240505160915.6boysum4f34siqct@awork3.anarazel.de> <20240505223546.6yvjzgqifuoiii3e@awork3.anarazel.de> <47ca6fcc687e408287871f7eaaaf3c3b@Optiver.com> <68430b1b76d44558b7b07ae8c69151f6@Optiver.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="F6EDKW2PmDELAMiU" Content-Disposition: inline In-Reply-To: <68430b1b76d44558b7b07ae8c69151f6@Optiver.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --F6EDKW2PmDELAMiU Content-Type: multipart/mixed; boundary="YXUgwLXGqI4Bhyfo" Content-Disposition: inline --YXUgwLXGqI4Bhyfo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 05, 2024 at 10:31:04AM +0000, Floris Van Nee wrote: > This patch would help in getting more info about this specific issue > if it reoccurs, but in that case it's only helpful if it's > backpatched. > Agree the refcount addition makes sense. Adding Bertrand in CC as he was similarly playing with this area. What would both of you think about the attached. This is a mix of what's been proposed on the two threads, with the addition of the refcount. -- Michael --YXUgwLXGqI4Bhyfo Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pgstat-drop-debug.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/= activity/pgstat_shmem.c index 4a4b69891d..fb79c5e771 100644 --- a/src/backend/utils/activity/pgstat_shmem.c +++ b/src/backend/utils/activity/pgstat_shmem.c @@ -785,7 +785,11 @@ pgstat_drop_entry_internal(PgStatShared_HashEntry *she= nt, * backends to release their references. */ if (shent->dropped) - elog(ERROR, "can only drop stats once"); + elog(ERROR, + "trying to drop stats entry already dropped: kind=3D%s dboid=3D%u objo= id=3D%u refcount=3D%u", + pgstat_get_kind_info(shent->key.kind)->name, + shent->key.dboid, shent->key.objoid, + pg_atomic_read_u32(&shent->refcount)); shent->dropped =3D true; =20 /* release refcount marking entry as not dropped */ --YXUgwLXGqI4Bhyfo-- --F6EDKW2PmDELAMiU Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmZhPqoACgkQnvQgOdby QH1zZg//YyLn3tTHDSZKTLnNhuaK/5lafTvapTYXFuRe7TGtMxc7CBMRKLrwLtzu Jd0fYQBvlTcRJdQ93q7K9yiVOaffUphCEErdhb5DEaNpHbHiS48xggPGLdEYk21M r2mZOanwawZBUh97mABTLiJwxCe17TH18Nsqd2+5uQvboYWb62D/77+TvceLf/u/ iq5dX08G/XL+SlpN9mlsrz0DZauey8NZJxHPqSjdVumkx9hIqx44sU13bGOPoEoU osOGH9+mlRniGOc3NKCUQyp6Sb94w6Mr5dX3y8K8ScpNF0obQ6/rCjGxI7K57Y/t G5TDXvWcvEedgo+2PPuEAYCGZtkWWWJZKCq7ra/wIbTV8y0Kyr/LV2u19GXgiVlI 3YuVdiJIwyX3C/sbFGxb8YGlncvojFZTayyVCLu3+iK1YOtZSr52G0AlKZXhp7RW vsgWYRUxLdnVbvQoMQimDB1HTrZBCnzBuVmQhqBTkAX+w3/ucp3EZ1Q/vueKCfud z47/OSQ2SWMvBEi469O6urDEot+eaVciGHOjJz+7ooZdeMpMBPuMxWrjOlvGl+Ci PM2wrJI+Q/xRbZL3IWPwVrqqtdMTPuZEYnlj3pOeBYc9gIZ/RKlGCdUyrZ6JK8B9 2nI05qwjX+xjYcUuN3z95acUVGRQ2+3x8WlMXrrVHk41CewtlyA= =4pfw -----END PGP SIGNATURE----- --F6EDKW2PmDELAMiU--