Sloppy port assignment in src/test/ldap/

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Sloppy port assignment in src/test/ldap/
Date: 2019-09-09 18:05:46
Message-ID: 25124.1568052346@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wondered about this transient failure:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2019-09-09%2008%3A48%3A25

The only information that was captured was

# Running: /usr/sbin/slapd -f /home/bf/bfr/root/HEAD/pgsql.build/src/test/ldap/tmp_check/slapd.conf -h ldap://localhost:57797 ldaps://localhost:57798
Bail out! system /usr/sbin/slapd failed

So, slapd failed without writing anything to stderr *or* its configured
log file, which is pretty unhelpful. But, casting about for a possible
explanation, I noticed the port setup code earlier in the script:

my $ldap_port = get_free_port();
my $ldaps_port = $ldap_port + 1;

Translated: we're finding one free port and just assuming that
the next one will be free (or even exists :-().

Sure enough, I can reproduce the failure seen on crake if I force
the $ldaps_port to be a port number that something has in use.
Presumably that transient failure occurred because something was
using 57798.

So this code needs to be

my $ldap_port = get_free_port();
my $ldaps_port = get_free_port();

I'll go fix that in a moment.

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-09-09 18:12:22 Re: pg_regress restart cluster?
Previous Message Andrew Dunstan 2019-09-09 17:32:30 Re: Does PostgreSQL support debian Linux on Arm CPU Platform?