Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-67626

Request caches based on JiraAuthenticationContextImpl can lead to a memory leak

    XMLWordPrintable

    Details

      Description

      Summary

      The way Jira cleans up some of it's request caches can lead to memory leaks for code executed outside of HTTP threads - caesium jobs or plugin-supplied long running threads.

      Details

      It applies to all request-scope caches provided by JiraAuthenticationContextImpl (AuthenticationContextImpl) and managed by JiraThreadLocalUtils.

      Jira API provides plugin vendors with a way to execute code outside of HTTP requests scope with OffRequestThreadExecutor
      It's supposed to properly initiate and destroy request caches.

      JiraAuthenticationContextImpl.clearRequestCache(); is called on preCall, but not on postCall

      Because of that request caches will not be cleaned up until the consecutive run of the job on the same java thread.

      Expected results

      Request caches are being cleaned properly after a plugin-supplied code is executed.

      Actual results

      Request caches are not cleaned and accumulate lots of unneeded objects in memory.

      Workaround

      Calling JiraAuthenticationContextImpl.clearRequestCache(); would ensure that a job is not leaving anything behind.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              tzwierzchowski Tomasz Zwierzchowski
              Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated: