Re: ssl tests aren't concurrency safe due to get_free_port()
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org,
Tom Lane <tgl@sss.pgh.pa.us>
Date: 2022-10-04T05:39:51Z
Lists: pgsql-hackers
On 2022-10-02 Su 12:49, Andres Freund wrote:
>
> 2) Use a lockfile containing a pid to protect the choice of a port within a
> build directory. Before accepting a port get_free_port() would check if the
> a lockfile exists for the port and if so, if the test using it is still
> alive. That will protect against racyness between multiple tests inside a
> build directory, but won't protect against races between multiple builds
> running concurrently on a machine (e.g. on a buildfarm host)
>
>
I think this is the right solution. To deal with the last issue, the
lockdir should be overrideable, like this:
my $port_lockdir = $ENV{PG_PORT_LOCKDIR} || $build_dir;
Buildfarm animals could set this, probably to the global lockdir (see
run_branches.pl). Prior to that, buildfarm owners could do that manually.
There are numerous examples of lockfile code in the buildfarm sources.
I'll try to hack something up.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
Commits
-
Fix prove_installcheck when used with PGXS
- b189f71e549f 11.20 landed
- 14bb2e76c7df 12.15 landed
- 6704944779cf 13.11 landed
- e07022500404 14.8 landed
- 3d37476f503f 15.3 landed
- 5d42a9751958 16.0 landed
-
Prevent port collisions between concurrent TAP tests
- 46def5267cf9 11.19 landed
- baa78ff5404c 12.14 landed
- 4b9013d64f23 13.10 landed
- 870d6218e6d7 14.7 landed
- 153e21567750 15.2 landed
- 9b4eafcaf41d 16.0 landed