users@glassfish.java.net

com.sun.jndi.ldap.Connection javax.naming.Communicatio: Too many files open

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Oct 2009 19:21:04 PDT

My migration from Tomcat 6 to Glassfish V2 has run into a snag.
If I use LDAP authentication on Glassfish during my automated stress tests I very quickly run out of file descriptors (see exception below). Note that This does not happen when I use tomcat 6. Could there be a file descriptor leak in the com.sun.jndi.ldap layer? Could it be something wrong elsewhere in my code or spring-ldap code? But then why would it only show up (and so quickly) in Glassfish?

This is a serious showstopper for our plans to migrate our product and customer deployments to Glassfish V2 and I would be very grateful for any help on figuring out.

Here is the exception:

Caused by: javax.naming.CommunicationException: 127.0.0.1:33389 [Root exception is java.net.SocketException: Too many open files]
        at com.sun.jndi.ldap.Connection.<init>(Connection.java:207)
        at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:118)
        at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
        at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2652)
        at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
        at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
        at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
        at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
        at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
        at org.springframework.ldap.core.support.LdapContextSource.getDirContextInstance(LdapContextSource.java:43)
        at org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:254)
        ... 62 more

The [url=http://forums.java.net/jive/servlet/JiveServlet/download/10361/lsof-p-glassfish.txt]attached file[/url] contains the output of command "lsof -p <glassfish pid>".
[Message sent by forum member 'najmi' (farrukh_at_wellfleetsoftware.com)]

http://forums.java.net/jive/thread.jspa?messageID=367363