From: Alexey Kondratov <a.kondratov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Free port choosing freezes when PostgresNode::use_tcp is used on BSD systems
Date: Wed, 21 Apr 2021 01:49:59 +0300
Message-ID: <3cba5930342a51665e6959002cedb4d9@postgrespro.ru> (raw)
In-Reply-To: <559792.1618931011@sss.pgh.pa.us>
References: <20210127213658.GA736@alvherre.pgsql>
<55c6c1526b94d2caf54c33262fe00674@postgrespro.ru>
<e15777decc533006c9dbe4988bd66d31@postgrespro.ru>
<YBTC0IYIGmyYfiIn@paquier.xyz>
<1c506564e2a732ec17790bd8c34f042e@postgrespro.ru>
<YBiro+n0767QDXSA@paquier.xyz>
<YBpEsxZxIVn0zyFM@paquier.xyz>
<66bad38beb87fb32952d89602e467444@postgrespro.ru>
<82e271a9a11928337fcb5b5e57b423c0@postgrespro.ru>
<459595.1618874567@sss.pgh.pa.us>
<519ddb94-f3ac-e9cc-3a61-7003c26f62f8@dunslane.net>
<559792.1618931011@sss.pgh.pa.us>
On 2021-04-20 18:03, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> On 4/19/21 7:22 PM, Tom Lane wrote:
>>> I wonder whether we could get away with just replacing the $use_tcp
>>> test with $TestLib::windows_os. It's not really apparent to me
>>> why we should care about 127.0.0.not-1 on Unix-oid systems.
>
>> Yeah
>> The comment is a bit strange anyway - Cygwin is actually going to use
>> Unix sockets, not TCP.
>> I think I would just change the test to this: $use_tcp &&
>> $TestLib::windows_os.
>
> Works for me, but we need to revise the comment to match.
>
Then it could be somewhat like that, I guess.
Regards
--
Alexey Kondratov
Postgres Professional https://www.postgrespro.com
Russian Postgres Company
Attachments:PostgresNode.diff (text/x-diff, 1.6K) downloaddiff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pmindex db47a97d196..f7b488ed464 100644--- a/src/test/perl/PostgresNode.pm+++ b/src/test/perl/PostgresNode.pm@@ -1191,19 +1191,19 @@ sub get_free_port
# Check to see if anything else is listening on this TCP port.
# Seek a port available for all possible listen_addresses values,
# so callers can harness this port for the widest range of purposes.
- # The 0.0.0.0 test achieves that for post-2006 Cygwin, which- # automatically sets SO_EXCLUSIVEADDRUSE. The same holds for MSYS (a- # Cygwin fork). Testing 0.0.0.0 is insufficient for Windows native- # Perl (https://stackoverflow.com/a/14388707), so we also test- # individual addresses.+ # The 0.0.0.0 test achieves that for MSYS, which automatically sets+ # SO_EXCLUSIVEADDRUSE. Testing 0.0.0.0 is insufficient for Windows+ # native Perl (https://stackoverflow.com/a/14388707), so we also+ # have to test individual addresses. Doing that for 127.0.0/24+ # addresses other than 127.0.0.1 might fail with EADDRNOTAVAIL on+ # non-Linux, non-Windows kernels.
#
- # On non-Linux, non-Windows kernels, binding to 127.0.0/24 addresses- # other than 127.0.0.1 might fail with EADDRNOTAVAIL. Binding to- # 0.0.0.0 is unnecessary on non-Windows systems.+ # That way, 0.0.0.0 and individual 127.0.0/24 addresses are tested+ # only on Windows when TCP usage is requested.
if ($found == 1)
{
foreach my $addr (qw(127.0.0.1),
- $use_tcp ? qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())+ $use_tcp && $TestLib::windows_os ? qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
{
if (!can_bind($addr, $port))
{
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: a.kondratov@postgrespro.ru, tgl@sss.pgh.pa.us, andrew@dunslane.net, pgsql-hackers@lists.postgresql.org
Subject: Re: Free port choosing freezes when PostgresNode::use_tcp is used on BSD systems
In-Reply-To: <3cba5930342a51665e6959002cedb4d9@postgrespro.ru>
* 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