Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21921

Lazy loaded report details are never released

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: sloccount-plugin
    • Labels:
      None
    • Environment:
      Version 1.15, introduced in 1.11
    • Similar Issues:

      Description

      SloccountResult.lazyLoad() caches the data to a member variable. The class is loaded during Jenkins startup (all build.xml files) and never released so Java garbage collector has no chance to trash the lazy loaded details since the reference exists forever. This is kind of a memory leak.

      Consider to make "private SloccountReport report" member transient and to use readResolve() from Java Serialization to transform legacy data instead of calling convertLegacyData() in getStatistics().

      Found during a work on Cppcheck's JENKINS-17363.

        Attachments

          Issue Links

            Activity

            Hide
            mixalturek Michal Turek added a comment -

            The issue introduced here.

            Show
            mixalturek Michal Turek added a comment - The issue introduced here.
            Hide
            mixalturek Michal Turek added a comment -

            Similar issue in Cppcheck plugin.

            Show
            mixalturek Michal Turek added a comment - Similar issue in Cppcheck plugin.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Michal Turek
            Path:
            src/main/java/hudson/plugins/sloccount/SloccountResult.java
            http://jenkins-ci.org/commit/sloccount-plugin/32b1fa89cbe28eeb0831db3d1f9dae39bb102a35
            Log:
            JENKINS-21921 Lazy loaded report details are never released

            • SloccountResult.lazyLoad() caches the data to a member variable. SloccountResult objects (all build.xml files) are loaded during Jenkins startup and never released so Java garbage collector has no chance to trash the lazy loaded details since the reference exists forever. This is kind of a memory leak.
            • Lazy loading reads the data everytime and doesn't use any cache, saving of memory is now prefered to performace. It is not expected the user will show the details very often, so it should be ok.
            • Explicit calls of convertLegacyData() replaced by readResolve() from Java serialization with the same effect.
            • Report object made transient, null is always passed in SloccountPublisher while storing.
            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/hudson/plugins/sloccount/SloccountResult.java http://jenkins-ci.org/commit/sloccount-plugin/32b1fa89cbe28eeb0831db3d1f9dae39bb102a35 Log: JENKINS-21921 Lazy loaded report details are never released SloccountResult.lazyLoad() caches the data to a member variable. SloccountResult objects (all build.xml files) are loaded during Jenkins startup and never released so Java garbage collector has no chance to trash the lazy loaded details since the reference exists forever. This is kind of a memory leak. Lazy loading reads the data everytime and doesn't use any cache, saving of memory is now prefered to performace. It is not expected the user will show the details very often, so it should be ok. Explicit calls of convertLegacyData() replaced by readResolve() from Java serialization with the same effect. Report object made transient, null is always passed in SloccountPublisher while storing.
            Hide
            mixalturek Michal Turek added a comment -

            Fixed, will be released in version 1.16.

            Show
            mixalturek Michal Turek added a comment - Fixed, will be released in version 1.16.

              People

              • Assignee:
                mixalturek Michal Turek
                Reporter:
                mixalturek Michal Turek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: