Hello hackers, Let me present you the first failure of 030_pager.pl (committed on 2025-10-07) produced by scorpion a week ago [1]: 404/404 psql - postgresql:psql/030_pager ERROR 182.25s exit status 29
[00:46:29.628](0.815s) # connect output:
# {
# 'stderr' => 'background_psql: ready
# ',
# 'stdout' => '\\\\echo \\'background_psql: ready\\'
# \\\\warn \\'background_psql: ready\\'
# psql (20devel)
# Type "help" for help.
#
# postgres=# \\\\echo \\'background_psql: ready\\'
# background_psql: ready
# postgres=# \\\\warn \\'background_psql: ready\\'
# '
# }
[00:49:30.263](180.635s) # die: IPC::Run: timeout on timer #1 at
/usr/share/perl5/IPC/Run.pm line 3361.
[00:49:30.264](0.000s) 1..0
IPC::Run: timeout on timer #1 at /usr/share/perl5/IPC/Run.pm line 3361.
Compare with the next (successful) run [2]:
[02:14:07.553](0.552s) # connect output:
# {
# 'stderr' => 'background_psql: ready
# ',
# 'stdout' => '\\\\echo \\'background_psql: ready\\'
# \\\\warn \\'background_psql: ready\\'
# psql (20devel)
# Type "help" for help.
#
# postgres=# \\\\echo \\'background_psql: ready\\'
# background_psql: ready
# postgres=# \\\\warn \\'background_psql: ready\\'
# postgres=# '
# }
[02:14:07.587](0.033s) ok 1 - execute SELECT query that needs no pagination
In the failed run, "connect output" doesn't end with "postgres=#".
I've reproduced this locally, with multiple 030 tests running in parallel,
and the debug logging added after:
@@ -3125,6 +3125,14 @@ PageOutputInternal(int lines, const printTableOpt *topt,
struct winsize screen_size;
result = ioctl(fileno(stdout), TIOCGWINSZ, &screen_size);
showed:
!!!PageOutputInternal| result: 0, screen_size.ws_row: 0, screen_size.ws_col: 0
With 030_pager.pl simplified to the attached and multiplied x40, the
following test run:
meson test psql_*/030_pager -j 10
reproduces the issue pretty reliably for me:
Ok: 36
Fail: 4
[14:06:57.115](0.005s) # connect output:
# {
# 'stderr' => 'background_psql: ready
# ',
# 'stdout' => '\\echo \'background_psql: ready\'^M
# \\warn \'background_psql: ready\'^M
# psql (20devel)^M
# Type "help" for help.^M
# ^M
# postgres=# \\echo \'background_psql: ready\'^M
# background_psql: ready^M
# postgres=# \\warn \'background_psql: ready\'^M
# postgres=# '
# }
[14:06:57.123](0.008s) # psql PTY check output:
# ^M<SZ, bytes(8))); print(f'ioctl1 rows={r} cols={c}')"^M
# ioctl1 rows=24 cols=80^M
# postgres=# \echo 'PTYCHECK_DONE'^M
# PTYCHECK_DONE^M
# postgres=#
[14:06:57.123](0.000s) ok 85 - non-zero size
[14:06:57.129](0.006s) # connect output:
# {
# 'stderr' => 'background_psql: ready
# ',
# 'stdout' => '\\echo \'background_psql: ready\'^M
# \\warn \'background_psql: ready\'^M
# psql (20devel)^M
# Type "help" for help.^M
# ^M
# postgres=# \\echo \'background_psql: ready\'^M
# background_psql: ready^M
# postgres=# \\warn \'background_psql: ready\'^M
# '
# }
[14:06:57.136](0.007s) # psql PTY check output:
# \! python3 -c "import fcntl,termios,struct; r,c,hp,wp=struct.unpack('HHHH', fcntl.ioctl(1, termios.TIOCGWINSZ,
bytes(8))); print(f'ioctl1 rows={r} cols={c}')"^M
# \echo 'PTYCHECK_DONE'^M
# postgres=# ^M<SZ, bytes(8))); print(f'ioctl1 rows={r} cols={c}')"^M
# ioctl1 rows=0 cols=0^M
# postgres=# \echo 'PTYCHECK_DONE'^M
# PTYCHECK_DONE^M
# postgres=#
[14:06:57.136](0.000s) not ok 86 - non-zero size
[14:06:57.136](0.000s) # Failed test 'non-zero size
# at /home/user/postgres/src/bin/psql_23/t/030_pager.pl line 42.
This anomaly is not reproduced with -Dreadline=disable, so I guess it's
caused by a race inside readline (it has its own set_winsize).
[1]
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=scorpion&dt=2026-08-13%2022%3A40%3A00
[2]
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=scorpion&dt=2026-08-14%2000%3A09%3A19
Best regards,
Alexander
030_pager.pl
Description: Perl program
