pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prevent port collisions between concurrent TAP tests
Date: Sun, 20 Nov 2022 15:07:57 +0000
Message-ID: <E1owlvJ-0005j1-1O@gemulon.postgresql.org> (raw)

Prevent port collisions between concurrent TAP tests

Currently there is a race condition where if concurrent TAP tests both
test that they can open a port they will assume that it is free and use
it, causing one of them to fail. To prevent this we record a reservation
using an exclusive lock, and any TAP test that discovers a reservation
checks to see if the reserving process is still alive, and looks for
another free port if it is.

Ports are reserved in a directory set by the environment setting
PG_TEST_PORT_DIR, or if that doesn't exist a subdirectory of the top
build directory as set by meson or Makefile.global, or its own
tmp_check directory.

The prove_check recipe in Makefile.global.in is extended to export
top_builddir to the TAP tests. This was already exported by the
prove_installcheck recipes.

Per complaint from Andres Freund

This will be backpatched in due course after some testing.

Discussion: https://postgr.es/m/20221002164931.d57hlutrcz4d2zi7@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9b4eafcaf41d1192a34b574c21262b755aa455ee

Modified Files
--------------
src/Makefile.global.in                   |  2 +-
src/test/perl/PostgreSQL/Test/Cluster.pm | 65 +++++++++++++++++++++++++++++---
2 files changed, 61 insertions(+), 6 deletions(-)



view thread (9+ messages)  latest in thread

Message-ID: <E1owlvJ-0005j1-1O@gemulon.postgresql.org>
Permalink:  ../E1owlvJ-0005j1-1O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1owlvJ-0005j1-1O@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net
  Subject: Re: pgsql: Prevent port collisions between concurrent TAP tests
  In-Reply-To: <E1owlvJ-0005j1-1O@gemulon.postgresql.org>
  References: <E1owlvJ-0005j1-1O@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox