zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfenes <...@git.apache.org>
Subject [GitHub] zookeeper issue #451: ZOOKEEPER-2184: Zookeeper Client should re-resolve hos...
Date Fri, 26 Jan 2018 11:02:35 GMT
Github user mfenes commented on the issue:

    https://github.com/apache/zookeeper/pull/451
  
    Re-resolving at StaticHostProvider level may not be sufficient as InetAddress.getAllByName(String
host) itself uses a Java-level cache inside InetAddress and turns to name service (e.g. DNS)
only if the host could not be found in the Java-level cache.
    Unfortunately, when Java resolves a new host using the name service, it puts the host
and its addresses in the cache with TTL cache FOREVER. 
    This means, once a host gets resolved by Java, it will never again turn to the name service
to re-resolve it. If a host's addresses get updated in DNS, the address cache in Java will
still contain the old entry forever.
    So re-resolving at StaticHostProvider won't help in this case, as InetAddress.getAllByName(String
host) will still return the old address(es) I think.
    Check the getCachedAddresses method inside InetAddress, the get() method of static final
class Cache inside InetAddress and sun.net.InetAddressCachePolicy.get() which returns cachePolicy
with default value -1 (FOREVER) if it is not overridden by Security properties "networkaddress.cache.ttl"
and "networkaddress.cache.negative.ttl".


---

Mime
View raw message