Re: ssl tests aren't concurrency safe due to get_free_port()

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: ssl tests aren't concurrency safe due to get_free_port()
Date: 2022-10-04 05:39:51
Message-ID: 7579f627-aad4-7a04-1a98-033cc6b3cca5@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2022-10-04 05:45:37 Re: New strategies for freezing, advancing relfrozenxid early
Previous Message Bharath Rupireddy 2022-10-04 05:36:15 Use XLogFromFileName() in pg_resetwal to parse position from WAL file