Metaspace Leak Due to classes not being cleaned up

Issue

  • I have been seeing Jenkins restart randomly due to memory issues but it still seems to have a lot of heap space unused before the crash
  • The metaspace on the machine where my Jenkins instance is running has been slowly filling up and we are not sure why

Environment

Cause 1

SandboxResolvingClassLoader.parentClassCache could leak loaders:
Whenever doing an import of classes using groovy scripts within plugins, there was the possibility to leak the class loader due to the cache holding the class reference

Resolution 1

SandboxResolvingClassLoader.parentClassCache could leak loaders:
This issue was fixed in this PR and merged in to version 1.60 of the script security plugin which means that you need to update to at least that version

Cause 2

JENKINS-50223:
Whenever a class was called within another class in a shared library, there was the possibility for it to take a very long time or never get removed from memory due to another caching issue

Resolution 2

JENKINS-50223:
This issue was fixed in the 2.69 version of the Pipeline: Groovy plugin with this PR which means that you need to update to at least that version

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.