This is an automated email from the ASF dual-hosted git repository. gaoyunhaii pushed a commit to branch release-1.16 in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.16 by this push: new 8a47420adfe [FLINK-27341][runtime] Remove LOOPBACK from TaskManager findConnectingAddress. 8a47420adfe is described below commit 8a47420adfe9af7f1c303874c7a32dab3229ea66 Author: Weihua Hu <huweihua....@gmail.com> AuthorDate: Thu Nov 10 17:19:27 2022 +0800 [FLINK-27341][runtime] Remove LOOPBACK from TaskManager findConnectingAddress. If JobManager and TaskManager run in same host, the previous logic will use LOOPBACK interface for TaskManager, thus other TaskManagers in different host can not connect with the TaskManager. This closes #21422. --- .../org/apache/flink/runtime/net/ConnectionUtils.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java index 84849c97b36..9f61caedbe0 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java @@ -58,7 +58,6 @@ public class ConnectionUtils { * state failed to determine the address. */ private enum AddressDetectionState { - LOOPBACK(100), /** Connect from interface returned by InetAddress.getLocalHost(). * */ LOCAL_HOST(200), /** Detect own IP address based on the target IP address. Look for common prefix */ @@ -116,7 +115,6 @@ public class ConnectionUtils { final List<AddressDetectionState> strategies = Collections.unmodifiableList( Arrays.asList( - AddressDetectionState.LOOPBACK, AddressDetectionState.LOCAL_HOST, AddressDetectionState.ADDRESS, AddressDetectionState.FAST_CONNECT, @@ -227,18 +225,6 @@ public class ConnectionUtils { private static InetAddress findAddressUsingStrategy( AddressDetectionState strategy, InetSocketAddress targetAddress, boolean logging) throws IOException { - if (strategy == AddressDetectionState.LOOPBACK) { - InetAddress loopback = InetAddress.getLoopbackAddress(); - - if (tryToConnect(loopback, targetAddress, strategy.getTimeout(), logging)) { - LOG.debug( - "Using InetAddress.getLoopbackAddress() immediately for connecting address"); - return loopback; - } else { - return null; - } - } - // try LOCAL_HOST strategy independent of the network interfaces if (strategy == AddressDetectionState.LOCAL_HOST) { InetAddress localhostName; @@ -446,7 +432,7 @@ public class ConnectionUtils { } if (targetAddress != null) { - AddressDetectionState strategy = AddressDetectionState.LOOPBACK; + AddressDetectionState strategy = AddressDetectionState.LOCAL_HOST; boolean logging = elapsedTimeMillis >= startLoggingAfter.toMillis(); if (logging) { @@ -463,9 +449,6 @@ public class ConnectionUtils { // pick the next strategy switch (strategy) { - case LOOPBACK: - strategy = AddressDetectionState.LOCAL_HOST; - break; case LOCAL_HOST: strategy = AddressDetectionState.ADDRESS; break;