Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-3940

Memory leak when calling RepositoryService.obtain with null workspaceName

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Trivial
    • Resolution: Unresolved
    • 2.10.1, 2.11.3
    • None
    • jackrabbit-spi2dav
    • Patch

    Description

      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:

      1. an instance of org.apache.jackrabbit.spi2dav.SessionInfoImpl created with null workspace name (line 770)
      2. HttpClient created for this sessionInfo and stored to cache with sessionInfo as a key (line 779)
      3. a new sessionInfo created with effective workspace name (line 793)
      4. 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.

      Attachments

        1. JCR-3940.patch
          0.9 kB
          Oleksandr Kuzmenko

        Activity

          People

            Unassigned Unassigned
            o.kuzmenko Oleksandr Kuzmenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified