AnsweredAssumed Answered

Session leak in JCR RepositoryImpl

Question asked by opepin@optaros.com on Aug 8, 2006
Latest reply on Sep 27, 2006 by davidc
Hello,

I got the following leak of JCR Session in
org.alfresco.jcr.repository.RepositoryImpl.login().

Scenario:
A runtime exception or error occurs during the:
authenticationService.authenticate(username, password);
(in my case it was a NoSuchMethodError caused by Hibernate LazyInitializer)

Result:
The session will not be deregistered correctly and the thread will not be able to use the repository anymore. (Only one active session is allowed per thread.)

Proposed fix:

Put the
registerSession(sessionImpl);
just before to return the session object ie: when no exeption can occur anymore.

Alternative:

Add a:
catch (Throwable t)
{
  deregisterSession();
  throw t;
}
Cheers,
Olivier

PS: Should I open it in JIRA ?

Outcomes