- Notifications
You must be signed in to change notification settings - Fork5
Commitfab84c7
committed
Improve PostgresNode.pm's logic for detecting already-in-use ports.
Buildfarm members bowerbird and jacana have shown intermittent "could notbind IPv4 socket" failures in the BinInstallCheck stage since mid-December,shortly after commits1caef31 and9821492 changed thelogic for selecting which port to use in temporary installations. Oneplausible explanation is that we are randomly selecting ports that arealready in use for some non-Postgres purpose. Although the code triedto defend against already-in-use ports, it used pg_isready to probethe port which is quite unhelpful: if some non-Postgres server respondsat the given address, pg_isready will generally say "no response",leading to exactly the wrong conclusion about whether the port is free.Instead, let's use a simple TCP connect() call to see if anything answerswithout making assumptions about what it is. Note that this means there'sno direct check for a conflicting Unix socket, but that should be okaybecause there should be no other Unix sockets in use in the temporarysocket directory created for a test run.This is only a partial solution for the TCP case, since if the port numberis in use for an outgoing connection rather than a listening socket, we'llfail to detect that. We could try to bind() to the proposed port as ameans of detecting that case, but that would introduce its own failuremodes, since the system might consider the address to remain reserved forsome period of time after we drop the bound socket. Close study of theerrors returned by bowerbird and jacana suggests that what we're seeingthere may be conflicts with listening not outgoing sockets, so let's trythis and see if it improves matters. It's certainly better than what'sthere now, in any case.Michael Paquier, adjusted by me to work on non-Windows as well as Windows1 parent8f91d87 commitfab84c7
1 file changed
+27
-13
lines changedLines changed: 27 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
| 93 | + | |
93 | 94 |
| |
94 | 95 |
| |
95 | 96 |
| |
| |||
98 | 99 |
| |
99 | 100 |
| |
100 | 101 |
| |
101 |
| - | |
| 102 | + | |
102 | 103 |
| |
103 | 104 |
| |
104 | 105 |
| |
105 | 106 |
| |
106 | 107 |
| |
| 108 | + | |
107 | 109 |
| |
108 |
| - | |
| 110 | + | |
109 | 111 |
| |
110 | 112 |
| |
111 | 113 |
| |
| |||
347 | 349 |
| |
348 | 350 |
| |
349 | 351 |
| |
350 |
| - | |
| 352 | + | |
351 | 353 |
| |
352 | 354 |
| |
353 | 355 |
| |
| |||
839 | 841 |
| |
840 | 842 |
| |
841 | 843 |
| |
842 |
| - | |
| 844 | + | |
843 | 845 |
| |
844 |
| - | |
845 |
| - | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
846 | 852 |
| |
847 |
| - | |
| 853 | + | |
| 854 | + | |
848 | 855 |
| |
849 |
| - | |
850 |
| - | |
851 |
| - | |
852 |
| - | |
853 |
| - | |
854 |
| - | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
855 | 869 |
| |
856 | 870 |
| |
857 | 871 |
| |
|
0 commit comments
Comments
(0)