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.96) (envelope-from ) id 1wTc1g-000doc-0E for pgsql-bugs@arkaria.postgresql.org; Sun, 31 May 2026 09:00:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wTc1e-007Cow-1q for pgsql-bugs@arkaria.postgresql.org; Sun, 31 May 2026 09:00:06 +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.96) (envelope-from ) id 1wTc1e-007Com-0t for pgsql-bugs@lists.postgresql.org; Sun, 31 May 2026 09:00:06 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wTc1c-00000000RWL-2hyQ for pgsql-bugs@lists.postgresql.org; Sun, 31 May 2026 09:00:06 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4903f7a90d1so80020235e9.2 for ; Sun, 31 May 2026 02:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780218003; x=1780822803; darn=lists.postgresql.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=MEYNl2HGq3daqRRV2T90SSZBQJNWx2N4Qw1lcoqynHk=; b=Sw9eB8N3AHSmuQuCPO/9VhlYN9oG+ITJ9z7zw32SNT5isS4r5Pcht4bQ84AyWK9Oky ByiTjMwIkUwZsQb/7dF2ObGiSD/NpqVI6RVOukKtXI9YQxU0KI3iwPQ6mvDzXpyfrTjQ QzLhh/uvQsCStVrbAaCW/jevupxZEkmN1Ezh66Phr3BMbNu0Jcxw2YfMACOftwkJW2fs UjjKdhsmLBT2ojbIa6Rix5oK6WI7lrwxc/yYD7/0QqyAI6fhVcSxXK9b/eVuS9WRfqTd Twhm6DSIL0ZOqgGCfVBH5DlVoElEOzR131ETfl4xl4jPFubz1Qu8zAf6u5TGSfYoErlJ lI2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780218003; x=1780822803; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MEYNl2HGq3daqRRV2T90SSZBQJNWx2N4Qw1lcoqynHk=; b=dGJNCkjLaXDFOKskyWmcy51smCaNVbkpmCwLPUslgfkR/THk4BOBKO2fM9UILH1Nke DaKJeE6P1IFFPezJjGpLTsxhr7tEpl9g5OHfdMmiOot5b3zzwYr/G/0Vfex1lJ92eNjw K8XpcSDjYWAJFWia1ePicHCQ6NgJ0jQGr/ZOlRTELp6MauC18UTAp+b3IkomvvbU5po5 5lIQWTabCIoaaseiZrjzK5ECkMFDyuApAXxSGxxQ//pl6rSB+YU1BHIb0oLrnU+JikCH yG3Xfv+Y4Eh+/2IsZSE0s/ysXj2QciwzlH0DGjSqWIifA5eIVeAi/vtTN8wfoYTFZQFU jgqg== X-Gm-Message-State: AOJu0YxnZA70IuzosUqSyyHhfNfzFf9iSvOjiNSXTyjBEVc8a4oFvD2Z nHfYD2u/HW9DNlmZwG5J4wvXWPSQhmCAigSyzKgQ9YnyESEKnBou1jnTl1seJw== X-Gm-Gg: Acq92OHII0bF9JBGBuLMeJJlCxeVO1U16Yo6rKzskn/7idDBOZ8M4AB2Fj7VfoYAbpt 3zUnPfe4cJZIhjGyZ2WEfmm+KIZ+cC/CItZjbMc8bcev2zfKsZ3bTamLBOtVExuv1N88tRsCxQe kudUDwStuEaByLvrLHDt3mW+nzvWz3dML+rOy7bQwWICH+tedqmS1R9PG89LJY3rVGf9JhNh6Jx 0OB2Os9UEMEDQcpn1Hub1uKFHPZDX4GahdInE4TvFkTlCMv+y58oR7U8hlMIWpm/SLVtmrOD60S RqVc4DZrIB59vnVMPcYDnLaIIJlPbqIjAZ3Th2Veleduf/Fu8J6pP8Or3tFIsVJLUYxH9rWRwe7 8n/Ul1taLJiKtv4lPMft8UO0dc0hrZQbIWOcQB/HY253HfCoNOOdLG1TqISVcjgHc0VjEn+YMJJ rTfVIl4qwPkjtnlIiudvgUm63Ef6WBD7bmxNM= X-Received: by 2002:a05:600d:8648:10b0:48f:e245:394e with SMTP id 5b1f17b1804b1-490a2943943mr91838765e9.27.1780218002957; Sun, 31 May 2026 02:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.68.143]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4909c0ec5f8sm71266635e9.3.2026.05.31.02.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 May 2026 02:00:02 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------46eH0X6hAlnnUMJlA3CqCNpR" Message-ID: Date: Sun, 31 May 2026 12:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #19494: Error on transaction commit inside pipeline triggers psql's Assert To: Michael Paquier Cc: pgsql-bugs@lists.postgresql.org References: <19494-97a86d84fee71c47@postgresql.org> Content-Language: en-US From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------46eH0X6hAlnnUMJlA3CqCNpR Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------46eH0X6hAlnnUMJlA3CqCNpR Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
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
--------------46eH0X6hAlnnUMJlA3CqCNpR--