karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glen Mazza (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-985) LDAPLoginModule generates a large number of DirContext objects
Date Tue, 08 Nov 2011 04:56:51 GMT

    [ https://issues.apache.org/jira/browse/KARAF-985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13146082#comment-13146082
] 

Glen Mazza commented on KARAF-985:
----------------------------------

The JavaDoc for NamingEnumeration.close()[1] says "If an enumeration proceeds to the end--that
is, until hasMoreElements() or hasMore() returns false-- resources will be freed up automatically
and there is no need to explicitly call close()."  For two out of the three cases with NamingEnumeration
in this file, either of the two methods above will indeed return false, so close() shouldn't
be needed then.  I did add in a close() in the proposed patch for the third case.

For DirContext(), I added in close() in the two of three scenarios where it wasn't already
being called.

[1] http://download.oracle.com/javase/6/docs/api/javax/naming/NamingEnumeration.html#close%28%29
                
> LDAPLoginModule generates a large number of DirContext objects
> --------------------------------------------------------------
>
>                 Key: KARAF-985
>                 URL: https://issues.apache.org/jira/browse/KARAF-985
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-config
>    Affects Versions: 2.2.4
>         Environment: Karaf 2.2.5-snapshot
>            Reporter: metatech
>            Priority: Minor
>         Attachments: LDAPLoginModule.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> In class org.apache.karaf.jaas.modules.ldap.LDAPLoginModule, "DirContext.close()" and
"NamingEnumeration.close()" are not called in all cases.
> Although it is not mandatory, it would be better to call it in all cases (to be sure,
in a "finally" block).
> http://download.oracle.com/javase/tutorial/jndi/ldap/close.html
> Otherwise, this leaves one "com.sun.jndi.ldap.Connection" thread running for each LDAP
request. After several minutes, the thread disappears automatically.  
> During a performance test with 10 concurrent users, this creates up to several hundreds
of such threads.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message