FULL PRODUCT VERSION : java version "1.4.2_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06) Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode) FULL OS VERSION : Windows 98 [Version 4.10.2222] (also known as Win98SE) EXTRA RELEVANT SYSTEM CONFIGURATION : This bug only occurs when the DNS server information is *not* obtained via DHCP, and is instead set manually via the TCP/IP properties (DNS Configuration tab). A DESCRIPTION OF THE PROBLEM : The java.net.InetAddress.getByName() in this configuration appears to always cache positive (successful) DNS lookup results, even if the "networkaddress.cache.ttl" property is set to zero. The InetAddress API and release notes clearly indicate this should force the InetAddress to make a fresh lookup from a DNS server, as it does when the DNS server information is obtained via DHCP. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Try to disable the cache by setting "networkaddress.cache.ttl" to zero; loop making calls to InetAddress.getByName(); note the lack of DNS activity on network. If you can't readily monitor the network activity, selecting a server that uses rotating DNS can easily illustrate the problem. PLEASE NOTE: The Win98SE environment *must* have a static IP address and use static DNS addresses, configured via the TCP/IP properties, in order to reproduce this bug. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - A fresh DNS request should be made for each iteration of the loop in the source code below. ACTUAL - One DNS request is made for the first iteration of the loop only, then the remaining lookups are fulfilled from the InetAddress cache (which should have been disabled). ERROR MESSAGES/STACK TRACES THAT OCCUR : None; it silently fails to operate in the prescribed manner. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.net.InetAddress; import java.net.UnknownHostException; import java.security.*; public class bug { public static void main(String [] args) throws InterruptedException { Security.setProperty("networkaddress.cache.ttl", "0"); System.out.println("Cache is confirmed: " + Security.getProperty("networkaddress.cache.ttl")); for (int i=0; i<25; i++) { try { System.out.println( InetAddress.getByName("www.cnn.com").getHostAddress()); } catch (UnknownHostException uhe) { System.out.println("UHE"); } Thread.sleep(1000); } } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : If Win98SE gets the DNS information from a DHCP server, this bug does not seem to occur. However, this workaround is unacceptable for our applications, which must use Win98SE without DHCP. ###@###.### 2005-03-29 18:28:54 GMT
|