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 1uMbkB-00GPV1-He for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Jun 2025 00:12:35 +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 1uMbk9-005sMJ-Ay for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Jun 2025 00:12:33 +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 1uMbk8-005sG0-E9 for pgsql-bugs@lists.postgresql.org; Wed, 04 Jun 2025 00:12:33 +0000 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uMbk6-0005IZ-2B for pgsql-bugs@lists.postgresql.org; Wed, 04 Jun 2025 00:12:32 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id C2260114011D; Tue, 3 Jun 2025 20:12:27 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Tue, 03 Jun 2025 20:12:27 -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=1748995947; x=1749082347; bh=GFE8Wwlhj+ 2+ClHztHeJiXXfqNs2JnHJOKAeUenZKKU=; b=YXrTwH1YRvmqkqAWsheHRmgYhD NW8mwLCOaSgK21dWXxl6XwEMg4kXEjZeif6cvh0bba5bKQcJbgZuzemIhqG8YiCn r1YKC5RPvbNvYlAD5fHng/y7VoAwMfZeGQldo1eyU8epJinzD/EfT+74HT6GNWp8 xuzHAWvHOcCVWAarLmTkuULEoF2jK+i+SpjbZZXiwOLSyOyYCEfX8kq0HRAhwD/J kFnJeGdknsr9hE0KHkZM7azro0X0ksuqzfJX6TZIAw3o7YHenzQa6GdsQmDmOpjB Pom5U7611mg0KZIr+nYHZpOncUyC/Ph+1mx+sIYCUKHIPF+kiiQdV2DETg/w== 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=fm1; t= 1748995947; x=1749082347; bh=GFE8Wwlhj+2+ClHztHeJiXXfqNs2JnHJOKA eUenZKKU=; b=aqwxdvumRyaMkzcmSoO1TVQoJozYdiA0AL3/7i83b7i71m42EUb cG2nZ06EBl6OOJ16EVG9O9tLSMIipPsE8GRbpUL1auf/iqS9f3LJwMHoGHC2qL/s abrOwmdJeuQ7wcHg4Q6Ej/ucNZGoM9ouTeOE+VogYn5aHyC007vInu6gQhtrr11o HxHyNYVtyzkf8H2+yzZfP4hckh9+aSmw2LvEERAFTJrlEFmiP17mGRKaeXBOJLk3 uf25CYDIFaxLowoqRQGgkiSlQrISeyO8gdUI0yVTbXvNuxc5Z3fpkZXUqMrfU5Ky YNB7CewI5qFMepjV2pK9sFDFZ8Ei/VLywtQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddufeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhf gggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruc eomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteel ieefudffhffhtdetleeggeegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtoheprghnthhhohhnihhnrdgsohhnnhgvfhhohiesuggrthgrughoghhh qhdrtghomhdprhgtphhtthhopehnrdhkrghlihhnihhnsehpohhsthhgrhgvshhprhhord hruhdprhgtphhtthhopehpghhsqhhlqdgsuhhgsheslhhishhtshdrphhoshhtghhrvghs qhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Jun 2025 20:12:25 -0400 (EDT) Date: Wed, 4 Jun 2025 09:12:17 +0900 From: Michael Paquier To: Anthonin Bonnefoy Cc: n.kalinin@postgrespro.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set Message-ID: References: <18944-8a926c30f68387dd@postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="REmcxCnJ2cdS0spZ" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --REmcxCnJ2cdS0spZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 03, 2025 at 11:56:51AM +0200, Anthonin Bonnefoy wrote: > I've tried to adjust the piped syncs counter, but that's not enough. > libpq's internal command queue still has the Syncs queued and will > stay in a busy pipeline state if the backend doesn't send the expected > ReadyForQuery. It could be possible to remove them from the queue with > pqCommandQueueAdvance, but that would require psql to include > libpq-int.h which is probably something we want to avoid. libpq-int.h is for internal purposes and should not be directly used in frontends, so that's a no-go. > It doesn't seem like this case can be handled gracefully. The provided > patch just aborts the connection from the frontend when excessive > piped syncs are detected to avoid staying stuck in this inconsistent > protocol state. I have been spending some time trying to get psql to gracefully handle this case, likely as you did by making ExecQueryAndProcessResults() fail gracefully, but even reinitializing the counters is not enough and I have also bumped into the libpq limitations. If somebody is excited enough to justify exposing these APIs, perhaps they'll have a good reason and a case to do so, but I'm not excited about doing that for this psql tooling: we are still able to serialize commands within a pipeline anyway. For now I have applied your patch, adding one extra test with COPY TO on top of the one with COPY FROM. -- Michael --REmcxCnJ2cdS0spZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmg/j2EACgkQnvQgOdby QH1XMQ//QgDETIswxF3v8XideZ/1LPLGX5lzLb+t1Krwn6OoRe/GS9MQDWl7ccDJ Prdav4O1pVjzPZC6uMHMVbP/9SpX5ECMmZeUXWt+1YDSWw9XjQo102nGcYJ6uqup EmZm7decFLPN8khZZ2TK2kY9BW0vWRha4+RD+Q1uBrOiQFeErLwrcGfvEDYeFdy/ jNosEBk34gNc55tNqK+LP1w24YYXL1lilmWMVZG41RetGHpJXoX7oQPchgGi9hwT lpuek4037oNQjMnjROrvtYAM/2JgyxTpcbdLAY+uM+axUlAmTo/aRnUvck1O6u67 6WTEMZGhLmHDZB+41kr+s8QebUzDWavEC1QL6xKaKUkFwz9glmQvmeEC6Q4RYqtd EZ7j53q9/tq/Gh0evpsqVjKTL5EZ68V/ma7dcpg+VmwfDXBVGaW5dAuo97EjJjah ZMQtlwL39ItJ0Ci24FORVcgQTLzi/cqg1lfJpx8hzHNUkjsSV+QBUeDJt90jL8sr hHhqHSGb8aiYsIqSBQehrNaGCUToULg3QbnYsUu+ABRKRRWZ6BFRUfZyhmMcWGNA p0O//yvP812cVIzZrjq0uxpDgKkkk4QiQpuIeuDPgu5mogJzPpjiU6hfh9GwuDrj o7mjWY0r+4QE3TtBYpB5EnWJd9Cw56RSnTMwW9JkIsxS3PkJ1dg= =juR6 -----END PGP SIGNATURE----- --REmcxCnJ2cdS0spZ--