pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: n.kalinin@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set
Date: Wed, 4 Jun 2025 09:12:17 +0900
Message-ID: <aD-PYXOv643xVcOf@paquier.xyz> (raw)
In-Reply-To: <CAO6_XqrQ+d3jqRg8dnW_LU+-k39ay6JSXOOsC9fe6u8hM2SQow@mail.gmail.com>
References: <18944-8a926c30f68387dd@postgresql.org>
	<aD1dPMIZzAwMKm7G@paquier.xyz>
	<CAO6_XqrmYG+V8n1ZWvUfrBt3aHExmysRdxaMNQi0sVYjcmW_WQ@mail.gmail.com>
	<aD40RKgfY4L4wnfL@paquier.xyz>
	<CAO6_XqrQ+d3jqRg8dnW_LU+-k39ay6JSXOOsC9fe6u8hM2SQow@mail.gmail.com>

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

Attachments:

  [application/pgp-signature] signature.asc (832B, ../aD-PYXOv643xVcOf@paquier.xyz/2-signature.asc)
  download

view thread (13+ messages)  latest in thread

Message-ID: <aD-PYXOv643xVcOf@paquier.xyz>
Permalink:  ../aD-PYXOv643xVcOf@paquier.xyz/
Also on:    postgresql.org/message-id/aD-PYXOv643xVcOf@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, anthonin.bonnefoy@datadoghq.com, n.kalinin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set
  In-Reply-To: <aD-PYXOv643xVcOf@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox