Github user zhangminglei commented on the issue:
https://github.com/apache/flink/pull/5449
Thank you for your response, @StephanEwen You are very correct. We would
not connect JM / RM / ZK if we use ```getByName("localhost")``` .
I will give an example based I have known about this issue.
We still can't believe ```getLocalHost()``` too much , as the file
```/etc/hosts``` once change the mapping of host name to an IP. That will cause
a problem after that. And we will get different value( that you set the mapping
including this value)
Below is my machine about this file, and I can always get a correct stuff
of ```ricezhang-pjhzf.vclound.com/10.199.203.242``` that works for my network
if I do not set that manually.
```
127.0.0.1 localhost localhost.localdomain localhost4
localhost4.localdomain4
::1 localhost localhost.localdomain localhost6
localhost6.localdomain6
```
Once I modify that file like below though, I will always get an
**incorrect** value, because ```192.168.1.1``` is a a fake address. and will
cause some issue.
```
127.0.0.1 localhost localhost.localdomain localhost4
localhost4.localdomain4
::1 localhost localhost.localdomain localhost6
localhost6.localdomain6
192.168.1.1 ricezhang-pjhzf.vclound.com
```
As refers to this **instability** test, **I don't know if something
dynamically modified that file on Travis** ? Or something like that ? Even if
not, we also CAN NOT rely on this method to get a IP that can connect to. Once
the ```Zookeeper``` records the incorrect IP address, this will cause error. We
can not get a correct IP to connect to what we want.
I agree with retry or a better test ( I do not know at this moment )
approach, I will study this issue in depth in these days.
---