Re: BUG #19494: Error on transaction commit inside pipeline triggers psql's Assert

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19494: Error on transaction commit inside pipeline triggers psql's Assert
Date: 2026-05-31 09:00:01
Message-ID: cce2ba8c-307e-4244-978e-91174073a4dc@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello Michael,

29.05.2026 08:00, Michael Paquier wrote:
> When ending the pipeline the loop consuming the results is stuck, so
> we could check the connection state. We are going to enter in a
> freeze of the branches due to beta1 next week, so let's take our time.
>
> Please feel to use the v2 attached for your tests. I am also testing
> it more on my side.

Thank you for the fix! I haven't discovered new issues so far.

I've found a way to trigger another assertion, but I don't think it's
legitimate:
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -880,7 +880,7 @@ RemoveSocketFiles(void)
 static void
 socket_set_nonblocking(bool nonblocking)
 {
-       if (MyProcPort == NULL)
+       if ((MyProcPort == NULL) || (rand() % 10 == 0))
                ereport(ERROR,
(errcode(ERRCODE_CONNECTION_DOES_NOT_EXIST),
                                 errmsg("there is no client connection")));

makes this script:
(
echo "\startpipeline"
for i in {1..50}; do echo "\syncpipeline"; done
echo "
SELECT 1;
\endpipeline

\startpipeline
SELECT 2;
\endpipeline
"
) | psql

trigger
psql: common.c:2055: ExecQueryAndProcessResults: Assertion `pset.piped_syncs > 0' failed.

Probably there could be another way to throw an ERROR on \syncpipeline,
but I have no good idea yet.

Running psql_pipeline in a loop with the above modification applied:
for i in {1..1000}; do echo "ITERATION $i"; NO_TEMP_INSTALL=1 TESTS=psql_pipeline make -s check-tests; done
I also observed the test hanging (at iterations 284. 543, 218) due to loss
of synchronization between psql and postgres.

Best regards,
Alexander

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2026-05-31 10:14:43 Re: BUG #19490: Streaming standby on 16.14 stops applying WAL on MultiXactOffsetSLRU when primary is 16.8
Previous Message Andrey Borodin 2026-05-30 18:47:00 Re: Possible G2-item at SERIALIZABLE