Hello Mikael,

31.08.2025 22:55, Mikael Kjellström wrote:

Yes, I will upgrade that animal to the latest release of NetBSD 10.1 I think.

[ a bit off-topic, but still related to sidewinder ]

I've noticed an interesting failure on sidewinder occurred recently [1]:
#   Failed test 'get an error when running within another function'
#   at t/049_wait_for_lsn.pl line 218.
# Looks like you failed 1 test of 33.
[23:19:49] t/049_wait_for_lsn.pl .................
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/33 subtests

The corresponding code in the test:
$node_standby->psql(
    'postgres',
    "SELECT pg_wal_replay_wait_wrap('${lsn3}');",
    stderr => \$stderr);
ok( $stderr =~
      /WAIT FOR must be called without an active or registered snapshot/,
    "get an error when running within another function");

But 049_wait_for_lsn_standby.log in fact contains:
2026-02-19 23:19:42.251 CET [7417:4] 049_wait_for_lsn.pl LOG: statement: SELECT 
pg_wal_replay_wait_wrap('2/570C0FC0');
2026-02-19 23:19:42.252 CET [7417:5] 049_wait_for_lsn.pl ERROR: WAIT FOR must be called without an active or registered snapshot 2026-02-19 23:19:42.252 CET [7417:6] 049_wait_for_lsn.pl DETAIL: WAIT FOR cannot be executed from a function or procedure, nor within a transaction with an isolation level higher than READ COMMITTED.
2026-02-19 23:19:42.252 CET [7417:7] 049_wait_for_lsn.pl CONTEXT: SQL statement 
"WAIT FOR LSN '2/570C0FC0';"
    PL/pgSQL function pg_wal_replay_wait_wrap(pg_lsn) line 3 at EXECUTE
2026-02-19 23:19:42.252 CET [7417:8] 049_wait_for_lsn.pl STATEMENT: SELECT 
pg_wal_replay_wait_wrap('2/570C0FC0');
2026-02-19 23:19:42.253 CET [7417:9] 049_wait_for_lsn.pl LOG: disconnection: session time: 0:00:00.005 user=pgbf database=postgres host=[local]

That is, the server returned the expected error, but the test didn't
receive it.

I've managed to reproduce this failure locally, on NetBSD 10.1, with the
following modification:
--- a/src/test/recovery/t/049_wait_for_lsn.pl
+++ b/src/test/recovery/t/049_wait_for_lsn.pl
@@ -211,13 +211,20 @@ LANGUAGE plpgsql;
 ]);

 $node_primary->wait_for_catchup($node_standby);
+
+for (my $i=1; $i<=50; $i++)
+{
+my $stdout;
 $node_standby->psql(
        'postgres',
-       "SELECT pg_wal_replay_wait_wrap('${lsn3}');",
+       "SELECT pg_wal_replay_wait_wrap('${lsn3}') /*$i*/;",
+        stdout => \$stdout,
        stderr => \$stderr);
+print("stdout: [$stdout]; stderr: [$stderr]\n");
 ok( $stderr =~
          /WAIT FOR must be called without an active or registered snapshot/,
-       "get an error when running within another function");
+       "get an error when running within another function ($i)");
+}

 # 6. Check parameter validation error cases on standby before promotion
 my $test_lsn =

when running multiple paralled test instances in a loop:
stdout: []; stderr: [psql:<stdin>:1: ERROR:  WAIT FOR must be called without an 
active or registered snapshot
DETAIL:  WAIT FOR cannot be executed from a function or procedure, nor within a transaction with an isolation level higher than READ COMMITTED.
CONTEXT:  SQL statement "WAIT FOR LSN '2/570C0FF8';"
PL/pgSQL function pg_wal_replay_wait_wrap(pg_lsn) line 3 at EXECUTE]
[09:33:27.469](0.062s) ok 25 - get an error when running within another 
function (14)
stdout: []; stderr: []
[09:33:27.636](0.168s) not ok 26 - get an error when running within another 
function (15)
[09:33:27.651](0.015s)
[09:33:27.652](0.001s) #   Failed test 'get an error when running within 
another function (15)'
#   at t/049_wait_for_lsn.pl line 225.
stdout: []; stderr: [psql:<stdin>:1: ERROR:  WAIT FOR must be called without an 
active or registered snapshot
DETAIL:  WAIT FOR cannot be executed from a function or procedure, nor within a transaction with an isolation level higher than READ COMMITTED.
CONTEXT:  SQL statement "WAIT FOR LSN '2/570C0FF8';"
PL/pgSQL function pg_wal_replay_wait_wrap(pg_lsn) line 3 at EXECUTE]

It reminded me of [2]. In my system, I found p5-IPC-Run-20231003.0nb1
installed. So I tried to update it with:
sudo pkg_delete p5-IPC-Run
git clone https://github.com/cpan-authors/IPC-Run.git
(cd IPC-Run*/ && perl Makefile.PL && make && sudo make install)
and it really helped -- no failure reproduced with many more runs. (I can
share my repro if needed.)

So maybe you could consider updating IPC::Run on sidewinder too...

[1] 
https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=sidewinder&dt=2026-02-19%2021%3A35%3A01&stg=recovery-check
[2] 
https://www.postgresql.org/message-id/fb666566-32bb-9c36-9c2e-3949b7a061bc%40gmail.com

Best regards,
Alexander


Reply via email to