'Bad file descriptor: dup2( 1, 2 )' error on MacOS CI tasks

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: 'Bad file descriptor: dup2( 1, 2 )' error on MacOS CI tasks
Date: 2026-04-01 13:28:21
Message-ID: CAN55FZ3VOUSO2ZmBUE9wRNnL9fUQfGv5qWefk_1pWYqgJ1bRSQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

psql/010_tab_completion, psql/030_pager and
authentication/001_password tests started to fail on MacOS CI tasks
[1]. Example failure log (error message is same on all of the failing
tests):

```
# Checking port 27038
# Found port 27038
Name: main
Version: 19devel
Data directory:
/Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/pgdata
Backup directory:
/Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/backup
Archive directory:
/Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/archives
Connection string: port=27038
host=/var/folders/hm/d7rr9ds96qx995ns72ry9g4m0000gn/T/rkP99U6zgp
Log file: /Users/admin/pgsql/build/testrun/psql/030_pager/log/030_pager_main.log
[11:23:15.358](0.026s) # initializing database system by copying initdb template
# Running: cp -RPp
/Users/admin/pgsql/build/tmp_install/initdb-template
/Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/pgdata
# Running: /Users/admin/pgsql/build/src/test/regress/pg_regress
--config-auth /Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/pgdata
### Starting node "main"
# Running: pg_ctl --wait --pgdata
/Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/pgdata
--log /Users/admin/pgsql/build/testrun/psql/030_pager/log/030_pager_main.log
--options --cluster-name=main start
waiting for server to start.... done
server started
# Postmaster PID for node "main" is 8554
Bad file descriptor: dup2( 1, 2 ) at
/Users/admin/pgsql/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
line 114.
at /Users/admin/pgsql/src/test/perl/PostgreSQL/Test/BackgroundPsql.pm line 114.
# Postmaster PID for node "main" is 8554
### Stopping node "main" using mode immediate
# Running: pg_ctl --pgdata
/Users/admin/pgsql/build/testrun/psql/030_pager/data/t_030_pager_main_data/pgdata
--mode immediate stop
waiting for server to shut down.... done
server stopped
# No postmaster PID for node "main"
```

My current hypothesis is that all of these three tests use 'IO::Pty'.
On MacOS CI, we install this via MacPorts using the 'p5.34-io-tty'
package [2], which was updated about 2.5 days ago. I am not sure if is
relevant but it has a known issue on Darwin [3]:

```
Darwin 7.9.0
HPUX 10.20 & 11.00
EOF on the slave tty is not reported back to the master.
```

I attempted to verify this by downgrading 'p5.34-io-tty' to the
previous version (1.20) and confirm that CI passes but I couldn't
confirm it as I don't have a MacOS machine and for some reason Cirrus
Terminal doesn't show up when I try to run CI with terminal access.

Please note that this problem doesn't happen on CFBot or Postgres CI
yet. I think there are two possible reasons:

1- We install packages by using MacPorts and then we save them as
cache so we don't need to install them for each CI Run. Problems will
start when this cache is invalidated or expired.
2- CFBot and Postgres CI use persistent workers. Cirrus CI might have
updated the Sequoia macOS VM images but persistent workers aren't
updated yet. Problems will start when they are updated.

[1] https://cirrus-ci.com/task/6188397108133888
[2] https://ports.macports.org/port/p5.34-io-tty/
[3] https://metacpan.org/pod/IO::Tty#VERIFIED-SYSTEMS,-KNOWN-ISSUES

--
Regards,
Nazir Bilal Yavuz
Microsoft

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Kupershmidt 2026-04-01 13:44:15 Todo item: Include the symbolic SQLSTATE name in verbose error reports
Previous Message Andres Freund 2026-04-01 13:26:00 Re: pg_waldump: support decoding of WAL inside tarfile