[ https://issues.apache.org/jira/browse/FLINK-8623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16395208#comment-16395208 ]
ASF GitHub Bot commented on FLINK-8623: --------------------------------------- Github user zhangminglei commented on the issue: https://github.com/apache/flink/pull/5449 Thanks @StephanEwen and @NicoK for the response and that let me know more about details about this issue. As refers to the first that return something we can bind to. Yes, As long as it is not the loopback address and I think it is okay for that. So, What do you think of if we add a check like the below, at this moment, I do not add a retry number here. Just give an example for hack this. But this might be cause an endless loop. ``` // our attempts timed out. use the heuristic fallback LOG.warn("Could not connect to {}. Selecting a local address using heuristics.", targetAddress); InetAddress heuristic = findAddressUsingStrategy(AddressDetectionState.HEURISTIC, targetAddress, true); if (heuristic != null) { while (heuristic.toString().contains("127.0.0.1") || heuristic.toString().contains("127.0.1.1")) { heuristic = findAddressUsingStrategy(AddressDetectionState.HEURISTIC, targetAddress, true); } return heuristic; } else { LOG.warn("Could not find any IPv4 address that is not loopback or link-local. Using localhost address."); InetAddress address = InetAddress.getLocalHost(); while (address.toString().contains("127.0.0.1") || address.toString().contains("127.0.1.1")) { address = InetAddress.getLocalHost(); } return address; } ``` @StephanEwen As refers the second , I think we can use the following code to find a stuff to bind to for the test. @NicoK Could you also take a look of those ? Thanks ~ ``` Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces(); while (nifs.hasMoreElements()) { NetworkInterface nif = nifs.nextElement(); Enumeration<InetAddress> addresses = nif.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); if (!(addr.getHostAddress().contains("127.0.0.1") || addr.getHostAddress().contains("127.0.1.1"))) { return addr; // this is the stuff we bind to } } } } ``` > ConnectionUtilsTest.testReturnLocalHostAddressUsingHeuristics unstable on > Travis > -------------------------------------------------------------------------------- > > Key: FLINK-8623 > URL: https://issues.apache.org/jira/browse/FLINK-8623 > Project: Flink > Issue Type: Bug > Components: Tests > Affects Versions: 1.5.0 > Reporter: Till Rohrmann > Priority: Blocker > Labels: test-stability > Fix For: 1.5.0, 1.4.3 > > > {{ConnectionUtilsTest.testReturnLocalHostAddressUsingHeuristics}} fails on > Travis: https://travis-ci.org/apache/flink/jobs/339344442 -- This message was sent by Atlassian JIRA (v7.6.3#76005)