postgresql/src
Tom Lane 803466b6ff Avoid picking already-bound TCP ports in kerberos and ldap test suites.
src/test/kerberos and src/test/ldap need to run a private authentication
server of the relevant type, for which they need a free TCP port.
They were just picking a random port number in 48K-64K, which works
except when something's already using the particular port.  Notably,
the probability of failure rises dramatically if one simply runs those
tests in a tight loop, because each test cycle leaves behind a bunch of
high ports that are transiently in TIME_WAIT state.

To fix, split out the code that PostgresNode.pm already had for
identifying a free TCP port number, so that it can be invoked to choose
a port for the KDC or LDAP server.  This isn't 100% bulletproof, since
conceivably something else on the machine could grab the port between
the time we check and the time we actually start the server.  But that's
a pretty short window, so in practice this should be good enough.

Back-patch to v11 where these test suites were added.

Patch by me, reviewed by Andrew Dunstan.

Discussion: https://postgr.es/m/3397.1564872168@sss.pgh.pa.us
2019-08-04 13:07:12 -04:00
..
backend Improve pruning of a default partition 2019-08-04 11:18:45 -04:00
bin Fix pg_dump's handling of dependencies for custom opclasses. 2019-07-31 15:42:49 -04:00
common Fix inconsistencies and typos in the tree 2019-07-29 12:28:30 +09:00
fe_utils Fix memory leak coming from simple lists built in reindexdb 2019-07-30 10:54:48 +09:00
include Improve pruning of a default partition 2019-08-04 11:18:45 -04:00
interfaces Fix format truncation issue from ECPG test 2019-08-02 09:51:12 +09:00
makefiles Remove support for non-ELF BSD systems 2019-07-01 23:56:20 +01:00
pl Fix inconsistencies and typos in the tree 2019-07-29 12:28:30 +09:00
port Fix failures to ignore \r when reading Windows-style newlines. 2019-07-25 12:11:17 -04:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Avoid picking already-bound TCP ports in kerberos and ldap test suites. 2019-08-04 13:07:12 -04:00
timezone Tweak our special-case logic for the IANA "Factory" timezone. 2019-07-26 13:07:08 -04:00
tools Fix inconsistencies and typos in the tree 2019-07-29 12:28:30 +09:00
tutorial Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Fix inconsistencies and typos in the tree 2019-07-29 12:28:30 +09:00
Makefile.shlib Remove support for non-ELF BSD systems 2019-07-01 23:56:20 +01:00
nls-global.mk Move logging.h and logging.c from src/fe_utils/ to src/common/. 2019-05-14 14:20:10 -04:00