[GLASSFISH-19433] JNDI lookup causes file descriptor leak Created: 12/Dec/12  Updated: 21/Mar/13  Resolved: 21/Mar/13

Status: Closed
Project: glassfish
Component/s: None
Affects Version/s: v2.1.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: myyron Assignee: guojun.shan
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Tags: jndi, leak


Whenever i do a remote lookup for a JNDI (tested on jms connection factory OR JDBC JNDI), there is always 1 file descriptor open left when my client application exits. I tried closing the context but still this did not resolve the issue.

Sample code:
InitialContext ic = null;
Properties properties = new Properties();
properties.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
properties.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
properties.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
properties.setProperty("org.omg.CORBA.ORBInitialHost", "testserver");
properties.setProperty("org.omg.CORBA.ORBInitialPort", "3100");

ConnectionFactory cf = null;
try {
ic = new InitialContext(properties);
cf = (ConnectionFactory) ic.lookup("jms/MyFactory");
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} finally {

How I confirmed the file descriptor still remains open in linux:
cd /proc/<glassfish pid>/fd
ls | wc -l
lsof -p <glassfish pid>

Comment by shreedhar_ganapathy [ 13/Dec/12 ]

Assigned to Michael for further reassignment - this issue is a v2.1.1 issue so needs to be triaged on whether this would affect current 3.x releases or 4.0

Comment by myyron [ 08/Jan/13 ]

Pls change priority of this issue to "Critical", as the open file limit problem causes the GlassFish to crash.

Our existing workaround for this problem is to monitor the number of open files for the GlassFish process and restart the domain whenever it is nearing the open files limit.


Comment by guojun.shan [ 16/Jan/13 ]

what is your the type of your client? standalone java client or application client?
did you try it with the latest version of Glassfish server?
what is your defintion of fd leak? the number of fd opened increase very time when you do remote JNDI access?

maybe we can disccuss it via email? guojun.shan@oracle.com

Comment by myyron [ 16/Jan/13 ]

thanks, lets dicuss through email, will send the reply shortly.

Comment by guojun.shan [ 21/Jan/13 ]

No such kind of issue on V3 and V4. suggest users to upgrade their Glassfish Server.

Comment by guojun.shan [ 21/Mar/13 ]

No such kind of issue on V3 and V4. suggest users to upgrade their Glassfish Server.

Generated at Thu Feb 23 05:32:45 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.