A DESCRIPTION OF THE PROBLEM :
While the reporter ofJDK-6376406 states that he is not violating any standard I doubt the same applies for Java - depending on its (default) configuration.
As section 4.1.3 of RFC 1035 states:
> [TTL is] a 32 bit unsigned integer that specifies the time
interval (in seconds) that the resource record may be
cached before it should be discarded. Zero values are
interpreted to mean that the RR can only be used for the
transaction in progress, and should not be cached.
Per Section 8 of RFC 2181:
> The TTL specifies a maximum time to live, not a mandatory time to live.
Per Section 4 of RFC 8767:
> [TTL is] a 32-bit unsigned integer number of seconds that specifies the
duration that the resource record MAY be cached before the
source of the information MUST again be consulted. Zero values
are interpreted to mean that the RR can only be used for the
transaction in progress, and should not be cached. Values
SHOULD be capped on the order of days to weeks, with a
recommended cap of 604,800 seconds (7 days). If the data is
unable to be authoritatively refreshed when the TTL expires, the
record MAY be used as though it is unexpired.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java.net.InetAddress.getByName("www.oracle.com");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Different IP addresses within the same running VM over time (as www.oracle.com resolves to Akamai CDN which will use different IP addresses over time).
I'd expect that it is not up to the runtime configuration if Java respects Internet Standards or not.
As the Security Manager now is deprecated it would also be a good idea to deprecate (and eventually remove) the setting "networkaddress.cache.ttl".
ACTUAL -
The same address regardless of the DNS TTL of oracle.com within a running VM as Java will cache the IP address indefinitely (depending on the configuration).
CUSTOMER SUBMITTED WORKAROUND :
java.security.Security.setProperty("networkaddress.cache.ttl", "0");
...which completely disables Javas internal DNS cache (if no Security Manager in use). But of course, this is not intended. Java should be able to cache as long as the DNS TTL record specifies it.
While the reporter of
As section 4.1.3 of RFC 1035 states:
> [TTL is] a 32 bit unsigned integer that specifies the time
interval (in seconds) that the resource record may be
cached before it should be discarded. Zero values are
interpreted to mean that the RR can only be used for the
transaction in progress, and should not be cached.
Per Section 8 of RFC 2181:
> The TTL specifies a maximum time to live, not a mandatory time to live.
Per Section 4 of RFC 8767:
> [TTL is] a 32-bit unsigned integer number of seconds that specifies the
duration that the resource record MAY be cached before the
source of the information MUST again be consulted. Zero values
are interpreted to mean that the RR can only be used for the
transaction in progress, and should not be cached. Values
SHOULD be capped on the order of days to weeks, with a
recommended cap of 604,800 seconds (7 days). If the data is
unable to be authoritatively refreshed when the TTL expires, the
record MAY be used as though it is unexpired.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java.net.InetAddress.getByName("www.oracle.com");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Different IP addresses within the same running VM over time (as www.oracle.com resolves to Akamai CDN which will use different IP addresses over time).
I'd expect that it is not up to the runtime configuration if Java respects Internet Standards or not.
As the Security Manager now is deprecated it would also be a good idea to deprecate (and eventually remove) the setting "networkaddress.cache.ttl".
ACTUAL -
The same address regardless of the DNS TTL of oracle.com within a running VM as Java will cache the IP address indefinitely (depending on the configuration).
CUSTOMER SUBMITTED WORKAROUND :
java.security.Security.setProperty("networkaddress.cache.ttl", "0");
...which completely disables Javas internal DNS cache (if no Security Manager in use). But of course, this is not intended. Java should be able to cache as long as the DNS TTL record specifies it.
- relates to
-
JDK-6376406 Default value of networkaddress.cache.ttl is too big
-
- Closed
-