Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oriXi-0000dA-V1 for pgsql-hackers@arkaria.postgresql.org; Sun, 06 Nov 2022 16:30:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oriXh-0007v5-Pp for pgsql-hackers@arkaria.postgresql.org; Sun, 06 Nov 2022 16:30:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oriXh-0007uv-GR for pgsql-hackers@lists.postgresql.org; Sun, 06 Nov 2022 16:30:41 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oriXe-0007oQ-HP for pgsql-hackers@postgresql.org; Sun, 06 Nov 2022 16:30:40 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id 0B35E60006; Sun, 6 Nov 2022 16:30:33 +0000 (UTC) Message-ID: <0867ca05-ed3f-09ca-cd41-d7087e542362@dunslane.net> Date: Sun, 6 Nov 2022 11:30:31 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: ssl tests aren't concurrency safe due to get_free_port() Content-Language: en-US To: Andres Freund Cc: pgsql-hackers@postgresql.org, Tom Lane References: <20221002164931.d57hlutrcz4d2zi7@awork3.anarazel.de> <7579f627-aad4-7a04-1a98-033cc6b3cca5@dunslane.net> <52266bf8-bf38-fdfa-9a77-1568f82b63b3@dunslane.net> <0891f64a-d30f-a1b7-9d0c-e447684cd8cd@dunslane.net> <20221105183643.v2nxsac3xlb3eazi@awork3.anarazel.de> From: Andrew Dunstan In-Reply-To: <20221105183643.v2nxsac3xlb3eazi@awork3.anarazel.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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