Closed arinban closed 13 years ago
@arinban Commented
@arinban Commented @arinban Commented
@arinban Commented @arinban Commented @glassfishrobot Commented Reported by nigeldeakin
@arinban Commented @arinban Commented @glassfishrobot Commented nigeldeakin said: It should be possible to change com.sun.genericra.util.ObjectBuilderFactory.createObject to call InitialContext.close() before letting the InitialContext go out of scope. If this is implemented correctly when using LdapCtxFactory this should solve the problem.
@arinban Commented @arinban Commented @glassfishrobot Commented Was assigned to nigeldeakin
@arinban Commented @arinban Commented @glassfishrobot Commented This issue was imported from java.net JIRA GENERICJMSRA-48
@arinban Commented @arinban Commented @glassfishrobot Commented Marked as fixed on Thursday, February 10th 2011, 6:43:56 pm
(Logged on behalf of an Oracle engineer)
When GenericJMSRA is initialized by GlassFish it is passed a class to act as a JNDI naming context factory, which it then uses to look up the connections it will make. Like many Java applications, GenericJMSRA makes the assumption that it can call 'new InitialContext (property_referencing_this_class)' as often as it likes with no consequences. It never calls 'close()' on the context returned.
This would be a safe thing to do in 99% of cases, but my customer uses LdapCtxFactory as the naming factory, so they can store configuration in an LDAP directory. But LdapCtxFactory creates a real, physical connection to the directory everytime someone does 'new InitialContext()' on it. It's one of the few JNDI factories I've seen that really does require the context be closed after use.
Anyway, because GRA never closes the context, the LDAP implementation never closes its connection, and over a period of a few weeks my customer is getting thousands of open connections to the directory, and then everything falls over.