[
https://issues.apache.org/jira/browse/KARAF-985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152765#comment-13152765
]
metatech commented on KARAF-985:
--------------------------------
There is still one bug with the fix :
In step 1, the "hasMore" is not called after the "next" is called, so the
naming enumeration is not automatically closed.
Here is the complete fix :
[192] SearchResult result = (SearchResult) namingEnumeration.next();
[193] userDN = (String) result.getName();
+ namingEnumeration.close();
With the complete fix, maximum 10 LDAP connections are simultaneously in
"ESTABLISHED" state (in netstat) with 10 concurrent users, instead of hundreds.
Beware that there are still cases (although I cannot give an practical example)
where a NamingException might be thrown by "next" or "hasMore", in which case
the naming enumeration would not be read up to the end.
> 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
> Assignee: Jean-Baptiste Onofré
> 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