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

FolderComputation memory leak

XMLWordPrintable

      Following an OOM (of Java heap) on a small (-Xmx512m) Jenkins instance, I've found in the heap dump ~ 760 000 jenkins.branch.MultiBranchProject$BranchIndexing objects (retaining 370 MB according to Eclipse MAT).

      I was first suspecting that branch-scanning was somehow blocked and that these objects were piling up in the queue, but no, it is actually some past successful executions which are never garbage collected.

      The explanation is simple, and it's not in the branch-api-plugin (although it would be possible to work-around the issue there), but in the cloudbees-folder-plugin.

      See there:

      So, FolderComputations can optionally be chained (a computation can have a reference to the previous computation), via a private transient property.  And BranchIndexing, indeed, sets this property.

      What is this property for? It is only used to enable finding the previous Result, which is used for choosing an the icon color:

      There is no accessor for this "previous" property other than this getPreviousResult() method, plus it's transient, so it is easily possible to avoid the infinitely growing linked list, and simply store the previous Result instead, without changing any public API.

      I will submit a PR.

       

       

            fcojfernandez Francisco Fernández
            tom_gl Thomas de Grenier de Latour
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: