Why do I receive java.lang.OutOfMemoryError: PermGen space

Issue

  • Get in Jenkins a stacktrace which says java.lang.OutOfMemoryError: PermGen space.
  • How to configure the windows slaves java heap settings
  • PermGen Space issue while deploying CloudBees Jenkins Operations Center

Environment

  • CloudBees Jenkins Enterprise
  • Microsoft Windows
  • Red Hat Enterprise Linux
  • Ubuntu

Resolution

You might need to increase the PermGen in case you have a value under 512m, which should be enough.

They way you can modify this value depends on the distribution and depending on the slave type

Master

  • In RedHat, for example, you can do it under /etc/sysconfig/jenkins using the variable JENKINS_JAVA_OPTIONS… i.e JENKINS_JAVA_OPTIONS=“-XX:MaxPermSize=512m”. 
  • In Ubuntu, the Jenkins configuration file is under /etc/default/jenkins and the variable to configure is JAVA_ARGS … i.e JAVA_ARGS=“-XX:MaxPermSize=512m”.

Slave

Sometimes slave machines will require permgen to be increased. Depending on the type of slave that is configured will require a different method for setting any java argument.

  • With SSH Slaves, the java process is started using an SSH command, so the “-XX:MaxPermSize=512m” can be set in the JVM Options in the Node configuration page.
  • With JNLP Slaves launching as a service on linux, you can add the VM arguments to the startup scripts (usually in /etc/sysconfig/jenkins or /etc/default/jenkins as part of the JAVA_ARGS variable)
  • With JNLP Slaves launching as a service on Windows requires modifications to be made on the jenkins.xml file which is located on slave machine in the JENKINS_HOME directory.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.