flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NicoK <...@git.apache.org>
Subject [GitHub] flink issue #5449: [FLINK-8623] ConnectionUtilsTest.testReturnLocalHostAddre...
Date Mon, 12 Mar 2018 10:44:16 GMT
Github user NicoK commented on the issue:

    Thanks @StephanEwen indeed - I also did not grasp the full intend of the change.
    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,
    		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.


View raw message