United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 5082105 InetAddress.isReachable() leaves open handles after execution
5082105 : InetAddress.isReachable() leaves open handles after execution

Details
Type:
Bug
Submit Date:
2004-08-03
Status:
Resolved
Updated Date:
2012-10-09
Project Name:
JDK
Resolved Date:
2004-09-10
Component:
core-libs
OS:
windows_2000
Sub-Component:
java.net
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0u1

Related Reports
Backport:

Sub Tasks

Description

Name: jl125535			Date: 08/03/2004


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

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

A DESCRIPTION OF THE PROBLEM :
Both builds "b58" and "b59" of j2sdk 1.5.0 are displaying behavior similar to that described by bug 5061568.

Snapshot version 1.5.0 b58 indicates that this bug has been fixed.

Here is the problem I found.

I executed isReachable on a list of different hosts and using taskmanager I found that there are handles never closed.
Using a better inspector instrumentation, like "process explorer" by sysinternals.com, I found that the opened handles are simply opened sockets.
So I think that the problem depicted by bug  5061568 has not been resolved

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
just write a simple program that check isReachable on a list of different hosts. If you see handle count of the process, it never decrease!

launch the given test case as 
> java Test host1 host2 host3 host4 host5 host6 host7

It pings regurarly these hosts then asks to press "enter". So I can check if handles have been closed with a monitoring program.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.net.*;

class Test{
  public static void main(String[] args){
    while(true)
    try{
      System.out.println("GO ON? press enter!");
      System.in.read();
      System.in.read();

      for(int i=0; i<args.length; i++){
        InetAddress inet = InetAddress.getByName(args[i]);
        System.out.print(args[i]+" is reachable? ");
        System.out.print(inet.isReachable(3000));
        inet = null;
        System.out.println();
      }
      System.gc();
    }catch(Exception e){
      e.printStackTrace();
    }
  }
} 

---------- END SOURCE ----------
(Incident Review ID: 289950) 
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.5.0_01
mustang

FIXED IN:
1.5.0_01
mustang

INTEGRATED IN:
1.5.0_01
mustang


                                     
2004-09-15
EVALUATION

Before the fix for 5061568 the code would use up 3 handles, after only 1 handle per call is used. What happens is that an event is created with WSACreateEvent() but is not closed (WSACloseEvent() should be called).
So the handle leaked is an Event handle, not as serious as a Socket, but still needs to be fixed as soon as possible. First update to Tiger would be the right target.

###@###.### 2004-08-12
                                     
2004-08-12



Hardware and Software, Engineered to Work Together