ASF GitHub Bot commented on FLINK-8623:

Github user NicoK commented on the issue:

    Thanks @StephanEwen indeed - I also did not grasp the full intend of the 
    Looking at the code again, basically 
`ConnectionUtils#findConnectingAddress()` tries to connect with a set of 
strategies for a given time and if that passes, it will fall back to the 
heuristic. We could argue that if we do not find an interface to connect to the 
target address in a given time, we may not do too much about it rather than (a) 
failing now, (b) retrying forever, or (c) trying some heuristic that may work 
or fail later. The latter is implemented and seems sensible - we also print 
warnings to the log in that case.
    For the unit test, however, I think, the actual check should be reduced to 
"does return something and does not block" since according to the code in 
`ConnectionUtils` we wouldn't verify the heuristic was successful anyway:
                // 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) {
                        return heuristic;
                else {
                        LOG.warn("Could not find any IPv4 address that is not 
loopback or link-local. Using localhost address.");
                        return InetAddress.getLocalHost();
    We could maybe cycle through `InetAddress.getAllByName("localhost")` and 
verify the returned value is in there - unless I read this wrong - but I don't 
know if that check is of any actual value, to be honest.
    If we wanted to test for more, the only outside sign of the heuristic 
strategy being used is to look at the logs.

> 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

Reply via email to