Re: ssl tests aren't concurrency safe due to get_free_port() - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: ssl tests aren't concurrency safe due to get_free_port()
Date
Msg-id 0867ca05-ed3f-09ca-cd41-d7087e542362@dunslane.net
Whole thread Raw
In response to Re: ssl tests aren't concurrency safe due to get_free_port()  (Andres Freund <andres@anarazel.de>)
Responses Re: ssl tests aren't concurrency safe due to get_free_port()
List pgsql-hackers
On 2022-11-05 Sa 14:36, Andres Freund wrote:
>>  
>>  use Carp;
>>  use Config;
>> -use Fcntl qw(:mode);
>> +use Fcntl qw(:mode :flock :seek O_CREAT O_RDWR);
> Does this do anything useful on windows?


All we're doing here on Windows and elsewhere is getting access to some
constants used in calls to flock(), seek() and sysopen(). It's not
actually doing anything else anywhere.


>
>> +    if ($pid +0 > 0)
> Gotta love perl.


Think of it as a typecast.


>
>
>> +    {
>> +        if (kill 0, $pid)
> Does this work on windows?
>
Yes, it's supposed to. It doesn't actually send a signal, it checks if
the process exists. There's some suggestion it might give false
positives on Windows, but that won't really hurt us here, we'll just
look for a different port.

One possible addition would be to add removing the reservation files in
an END handler. That would be pretty simple.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com




pgsql-hackers by date:

Previous
From: Nikolay Shaplov
Date:
Subject: Re: [PATCH] New [relation] option engine
Next
From: Tom Lane
Date:
Subject: Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands