Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1d997cb

Browse filesBrowse 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 d48212c commit 1d997cb
Copy full SHA for 1d997cb

File tree

Expand file treeCollapse file tree

1 file changed

+15
-18
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-18
lines changed

‎src/test/perl/PostgresNode.pm

Copy file name to clipboardExpand all lines: src/test/perl/PostgresNode.pm
+15-18Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -977,28 +977,25 @@ sub get_new_node
977977
$found = 0 if ($node->port == $port);
978978
}
979979

980-
# Check to see if anything else is listening on this TCP port. This
981-
# is *necessary* on $use_tcp (Windows) configurations. Seek a port
982-
# available for all possible listen_addresses values, for own_host
983-
# nodes and so the caller can harness this port for the widest range
984-
# of purposes. The 0.0.0.0 test achieves that for post-2006 Cygwin,
985-
# which automatically sets SO_EXCLUSIVEADDRUSE. The same holds for
986-
# MSYS (a Cygwin fork). Testing 0.0.0.0 is insufficient for Windows
987-
# native Perl (https://stackoverflow.com/a/14388707), so we also test
988-
# individual addresses.
980+
# Check to see if anything else is listening on this TCP port.
981+
# Seek a port available for all possible listen_addresses values,
982+
# so callers can harness this port for the widest range of purposes.
983+
# The 0.0.0.0 test achieves that for MSYS, which automatically sets
984+
# SO_EXCLUSIVEADDRUSE. Testing 0.0.0.0 is insufficient for Windows
985+
# native Perl (https://stackoverflow.com/a/14388707), so we also
986+
# have to test individual addresses. Doing that for 127.0.0/24
987+
# addresses other than 127.0.0.1 might fail with EADDRNOTAVAIL on
988+
# non-Linux, non-Windows kernels.
989989
#
990-
# This seems like a good idea on Unixen as well, even though we don't
991-
# ask the postmaster to open a TCP port on Unix. On Non-Linux,
992-
# non-Windows kernels, binding to 127.0.0.1/24 addresses other than
993-
# 127.0.0.1 might fail with EADDRNOTAVAIL. Binding to 0.0.0.0 is
994-
# unnecessary on non-Windows systems.
995-
#
996-
# XXX A port available now may become unavailable by the time we start
997-
# the postmaster.
990+
# Thus, 0.0.0.0 and individual 127.0.0/24 addresses are tested
991+
# only on Windows and only when TCP usage is requested.
998992
if ($found == 1)
999993
{
1000994
foreach my $addr (qw(127.0.0.1),
1001-
$use_tcp ? qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
995+
$use_tcp ? qw(127.0.0.2 127.0.0.3 0.0.0.0) : ())
996+
$use_tcp && $TestLib::windows_os
997+
? qw(127.0.0.2 127.0.0.3 0.0.0.0)
998+
: ())
1002999
{
10031000
can_bind($addr, $port) or $found = 0;
10041001
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.