JDK-5083006 : java.net.InetAddress.isReachable() throws ConnectException after extended use
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-08-05
  • Updated: 2004-08-05
  • Resolved: 2004-08-05
Related Reports
Duplicate :  
Description

Name: js151677			Date: 08/05/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Network Adapter: Intel(R) PRO/1000 MT

A DESCRIPTION OF THE PROBLEM :
I have written an application to monitor the network connectivity of several servers by "pinging" them with InetAddress.isReachable() 10 times at 10 minute intervals. It runs without flaw for approximately 5 hours, but then I recieve a ConnectException for each server I am trying to "ping." Each server has its own thread (13 in all). After 5 hours, the exception occurrs on about 5 of the 10 ping attempts. The other 5 work fine.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start 13 threads at minimum priority.
Each of these thread's run methods should be an infinite loop which tests a server's reachability with the InetAddress.isReachable() method 10 times in a row and then sleeps for 10 minutes.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Application should run indefinitely without ever having any output.
ACTUAL -
An exception is thrown after executing my application for about 5 hours.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.net.ConnectException: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
	at java.net.Inet4AddressImpl.isReachable0(Native Method)
	at java.net.Inet4AddressImpl.isReachable(Inet4AddressImpl.java:52)
	at java.net.InetAddress.isReachable(InetAddress.java:418)
	at java.net.InetAddress.isReachable(InetAddress.java:377)
	at com.hca.utils.PingUtility$PingThread.run(PingUtility.java:438)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
//This is an example of the type of thing I am doing. The problem may
// require multiple threads running this same code to produce the
// results I have seen.
while(true)
{
     for(int i=0; i < 10; i++)
     {
          try
          {
               InetAddress addy = InetAddress.getByName("java.sun.com");
               boolean isReachable = addy.isReachable();
          }
          catch(Throwable t)
          {
               t.printStackTrace();
          }
     }

     try
     {
          Thread.sleep(10 * 60 * 1000);
     }
     catch(InterruptedException ie)
     {
          ie.printStackTrace();
     }
} 
---------- END SOURCE ----------
(Incident Review ID: 295880) 
======================================================================

Comments
EVALUATION Fixed in tiger-rc ###@###.### 2004-08-05
05-08-2004