Profile Image
Ram Lakshmanan

Jenkins OutOfMemoryError

Jenkins is running in 2.401.2 version. Intermittently this Jenkins application was throwing java.lang.OutOfMemoryError. We captured the heap dump from the Jenkins and analyzed it through yCrash’s HeapHero tool. Below is the summary of the findings pointed out by the HeapHero tool:

 

  1. Tool reported two problem suspects. Problem Suspect 1 was a thread’s local variable occupying 56.73% of memory. Problem Suspect 2 was another thread’s local variable occupying 27.62% of memory.

 

  1. Below is the excerpt from the Largest Object section of the Heap dump analysis report. You can notice that thread has a local variable of type ‘org.kohuske.stapler.export.Property$BufferedDataWriter’. This variable alone is occupying 3.36GB of data.

 

Apparently ‘org.kohuske.stapler.export.Property$BufferedDataWriter’ internally contains an ArrayList’ which has several millions of records in it. It’s not clear why several millions of records are accumulated in this ‘ArrayList’.

 

Quick Googling revealed that ‘org.kohuske.stapler.export.Property$BufferedDataWriter’ is present in the Stapler library. Apparently Stapler is a web framework used by Jenkins to build user friendly URLs.

 

It isn’t clear what’s causing memory leak in this Stapler framework. Appreciate any of your insights.

  • jenkins

  • stapler

  • memoryleak

  • outofmemoryerror

Please Sign In or to post your comment or answer

Profile Image

Kousika M

From the information provided, best guess is that they have a lot of agents and the api call they are making is not using the 'tree' parameter to limit the data pulled by the request. We have a KB article about this here: https://docs.cloudbees.com/docs/cloudbees-ci-kb/latest/best-practices/best-practice-for-using-jenkins-rest-api

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jenkins

  • stapler

  • memoryleak

  • outofmemoryerror