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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I wondered about this transient failure:

The only information that was captured was

# Running: /usr/sbin/slapd -f /home/bf/bfr/root/HEAD/ -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?