You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Oleksandr Kuzmenko (JIRA)" <ji...@apache.org> on 2015/12/19 17:44:46 UTC

[jira] [Created] (JCR-3940) Memory leak when calling RepositoryService.obtain with null workspaceName

Oleksandr Kuzmenko created JCR-3940:
---------------------------------------

             Summary: Memory leak when calling RepositoryService.obtain with null workspaceName
                 Key: JCR-3940
                 URL: https://issues.apache.org/jira/browse/JCR-3940
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-spi2dav
    Affects Versions: 2.11.3, 2.10.1
            Reporter: Oleksandr Kuzmenko
            Priority: Trivial


The bug is located in method *org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(CredentialsWrapper credentials, String workspaceName)*

When passing null to *workspaceName* parameter that's what happens:
# an instance of org.apache.jackrabbit.spi2dav.SessionInfoImpl created with null workspace name (line 770)
# HttpClient created for this sessionInfo and stored to cache with sessionInfo as a key (line 779)
# a new sessionInfo created with effective workspace name (line 793)
# sessionInfo with effective workspace name returned to caller

The problem is that HttpClient created on step 2 will not be removed from cache on call to *org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.dispose(SessionInfo)* because it is linked to sessionInfo created on step 1 which is thrown away on step 3.

The proposed solution is pretty easy - just call *removeClient(SessionInfo)* before creating new sessionInfo on step 3.
See attached patch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)