Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6714797
Votes 0
Synopsis InitialContext.close does not close NIO socket connections
Category jndi:cosnaming
Reported Against b02
Release Fixed 6u13-rev(b06)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs 6779953 , 6790292 , 6821937
Submit Date 16-JUN-2008
Description
This came as a customer concern on bug 4925258.

The test case did a loop on a creation on InitialContext and closing it immediately after connecting to appserver 8.2 EE.  After 2 mins timeout, the reader thread is stopped, so the fix for 4925258 is  customer .

However netstat reveals that the physical connection is not closed.

I am attaching the test case.
Posted Date : 2008-06-16 08:07:52.0
Work Around
N/A
Evaluation
Hi Sunita,

I have use below test applicatioin to verify the fix result.
I think fix result is ok.

cat HelloClient.java
--------------------------------------------------------
package hello;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;

public class HelloClient {

       public static void main(String[] args) {
               try {
                       Properties env = new Properties();
                       env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
                       env.put(Context.PROVIDER_URL, "iiop://129.158.147.250:38056");

                       Context initial = new InitialContext(env);
                       System.out.println("debug-1");

                       /* create context */
                       initial.close();
                       initial = new InitialContext(env);
                       initial.close();
                       initial = new InitialContext(env);
                       initial.close();
                       initial = new InitialContext(env);
                       initial.close();
                       initial = new InitialContext(env);
                       initial.close();
                       initial = new InitialContext(env);
                       initial.close();
                       initial = new InitialContext(env);
                       initial.close();

                       /* 10 seconds loop and run netstat -a to confirm connection status */
                       Thread.sleep(10000);
                       System.exit(1);

                       HelloHome home = (HelloHome) PortableRemoteObject.narrow(
                                       initial.lookup("Hello"), HelloHome.class);
                       System.out.println("debug-2");
                       Hello hello = home.create();
                       System.out.println("Message: " + hello.hello() );
               } catch (Exception ex) {
                       System.err.println("Caught an unexpected exception!");
                       ex.printStackTrace();
               }
       }
}
--------------------------------------------------------


[reproducte same issue with jdk1.6.0_04 as below]

bash-2.05# /masa/jdk/eric/jdk1.6.0_04/bin/java hello.HelloClient
debug-1
bash-2.05#
bash-2.05# netstat -a | grep 38056
sslab152.35084       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
sslab152.35088       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
sslab152.35089       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
sslab152.35090       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
sslab152.35091       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
sslab152.35092       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
sslab152.35093       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
bash-2.05# netstat -a | grep 38056
sslab152.35084       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35088       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35089       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35090       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35091       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35092       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35093       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT


[Can not reprocude same issue with fixed java which in j2sdk-image]

bash-2.05# /masa/jdk/eric/j2sdk-image/bin/java hello.HelloClient
debug-1
bash-2.05#

bash-2.05# netstat -a | grep 38056
sslab152.35107       b2500.PRC.Sun.COM.38056 49376      0 48776      0 ESTABLISHED***
bash-2.05# netstat -a | grep 38056
sslab152.35107       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35111       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35112       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35113       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35114       b2500.PRC.Sun.COM.38056 49640    263 49640      0 ESTABLISHED***
bash-2.05# netstat -a | grep 38056
sslab152.35107       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35111       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35112       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35113       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35114       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35115       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35116       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
bash-2.05# netstat -a | grep 38056
sslab152.35107       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35111       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35112       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35113       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35114       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35115       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35116       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
bash-2.05# netstat -a | grep 38056
sslab152.35107       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35111       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35112       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35113       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35114       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35115       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35116       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
bash-2.05# netstat -a | grep 38056
sslab152.35107       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35111       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35112       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35113       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35114       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35115       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT
sslab152.35116       b2500.PRC.Sun.COM.38056 49376      0 48776      0 TIME_WAIT


Could you please build a test binary for end-user , so that we can request end-user to verify it too?

Thanks & regards,
Eric
Posted Date : 2008-10-01 17:24:03.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang