Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d064afc

Browse files
committed
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
1 parent d84ffff commit d064afc

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/test/perl/PostgresNode.pm

+12-9
Original file line numberDiff line numberDiff line change
@@ -1332,19 +1332,22 @@ sub get_free_port
13321332
# Check to see if anything else is listening on this TCP port.
13331333
# Seek a port available for all possible listen_addresses values,
13341334
# so callers can harness this port for the widest range of purposes.
1335-
# The 0.0.0.0 test achieves that for post-2006 Cygwin, which
1336-
# automatically sets SO_EXCLUSIVEADDRUSE. The same holds for MSYS (a
1337-
# Cygwin fork). Testing 0.0.0.0 is insufficient for Windows native
1338-
# Perl (https://stackoverflow.com/a/14388707), so we also test
1339-
# individual addresses.
1335+
# The 0.0.0.0 test achieves that for MSYS, which automatically sets
1336+
# SO_EXCLUSIVEADDRUSE. Testing 0.0.0.0 is insufficient for Windows
1337+
# native Perl (https://stackoverflow.com/a/14388707), so we also
1338+
# have to test individual addresses. Doing that for 127.0.0/24
1339+
# addresses other than 127.0.0.1 might fail with EADDRNOTAVAIL on
1340+
# non-Linux, non-Windows kernels.
13401341
#
1341-
# On non-Linux, non-Windows kernels, binding to 127.0.0/24 addresses
1342-
# other than 127.0.0.1 might fail with EADDRNOTAVAIL. Binding to
1343-
# 0.0.0.0 is unnecessary on non-Windows systems.
1342+
# Thus, 0.0.0.0 and individual 127.0.0/24 addresses are tested
1343+
# only on Windows and only when TCP usage is requested.
13441344
if ($found == 1)
13451345
{
13461346
foreach my $addr (qw(127.0.0.1),
1347-
$use_tcp ? qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
1347+
$use_tcp ? qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
1348+
$use_tcp && $TestLib::windows_os
1349+
? qw(127.0.0.2 127.0.0.3 0.0.0.0)
1350+
: ())
13481351
{
13491352
if (!can_bind($addr, $port))
13501353
{

0 commit comments

Comments
 (0)