aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2021-04-21 10:21:22 -0400
committerAndrew Dunstan <andrew@dunslane.net>2021-04-21 10:25:39 -0400
commitd673905d8951b4d8d52b91f07c5fa61e404489f6 (patch)
tree563bff06c9037ec23b06f0a12e3d5488e1b0bbcf
parent7311fa8a7096b3a00fc39a10c5a20d4cf0564bfa (diff)
downloadpostgresql-d673905d8951b4d8d52b91f07c5fa61e404489f6.tar.gz
postgresql-d673905d8951b4d8d52b91f07c5fa61e404489f6.zip
Only ever test for non-127.0.0.1 addresses on Windows in PostgresNode
This has been found to cause hangs where tcp usage is forced. Alexey Kodratov Discussion: https://postgr.es/m/82e271a9a11928337fcb5b5e57b423c0@postgrespro.ru Backpatch to all live branches
-rw-r--r--src/test/perl/PostgresNode.pm21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 9a78947572d..6d69cf1d0e0 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -1111,19 +1111,22 @@ 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.
+ # Thus, 0.0.0.0 and individual 127.0.0/24 addresses are tested
+ # only on Windows and only 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 ? 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))
{