Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: n(dot)kalinin(at)postgrespro(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18944: Assertion Failure in psql with idle_session_timeout Set
Date: 2025-06-03 09:56:51
Message-ID: CAO6_XqrQ+d3jqRg8dnW_LU+-k39ay6JSXOOsC9fe6u8hM2SQow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jun 3, 2025 at 1:31 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> Hmm. This stuff stands as it is in the backend COPY code since
> c01641f8aed0 from 2003, so there's not much we can do in the backend
> or libpq. Adding some specific logic in psql to avoid piped_syncs
> seems like the correct move seen from here.
>
> Most of that should be close to ExecQueryAndProcessResults(), don't
> you think? That's where we count the number of piped syncs.

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.

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.

Attachment Content-Type Size
v01-0001-Abort-connection-when-sync-is-sent-after-a-COPY.patch application/octet-stream 3.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message vignesh C 2025-06-03 12:24:16 Re: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5
Previous Message PG Bug reporting form 2025-06-03 09:23:42 BUG #18946: Installation Setup File