cancel
Showing results for 
Search instead for 
Did you mean: 

Session leak in JCR RepositoryImpl

opepin
Champ in-the-making
Champ in-the-making
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 ?
2 REPLIES 2

andy
Champ on-the-rise
Champ on-the-rise
Hi

Please add this to Jira.

Regards

Andy

davidc
Star Contributor
Star Contributor
Thank you for spotting.

A fix has been checked-in for 1.4.