简体   繁体   中英

Fixing out-of-memory in Jenkins with quality plugins

What I do know is that my Jenkins tanked last night while I was installing and configuring quality plugins with an existing job. At first the job appeared to hang, then the server itself became non-responsive. The last lines from the job console were:

[INFO] Generating "Project Team" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Summary" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependencies" report    --- maven-project-info-reports-plugin:2.7
[CHECKSTYLE] Parsing file /var/lib/jenkins/jobs/fedsso-dev/workspace/target/checkstyle-result.xml
[CHECKSTYLE] Successfully parsed file /var/lib/jenkins/jobs/fedsso-dev/workspace/target/checkstyle-result.xml of module mdlive-sso with 9924 warnings.
FATAL: PermGen space
FATAL: PermGen space
Finished: null

At this point the server was out in the woods and I couldn't even stop it with server jenkins stop , having to kill -9 the process.

It looks like something ran out of memory, but I am new to getting Jenkins, Maven and plugins to play nice. The /etc/default/jenkins file does not specify a JVM heap size so I think it is using default which I believe would be 256MB, but the Jenkins process in top was running with over 2GB of virtual memory. I understand from https://wiki.jenkins-ci.org/display/JENKINS/Builds+failing+with+OutOfMemoryErrors that I should consider the perm size as well (which looks like it is related to "FATAL: PermGen space") and also the maven task memory.

The VM host I am running on has been set up with 7GB of memory and the machine is dedicated to Jenkins and hopefully a future install of SonarQube so I have some room to change memory settigns. Can someone help me make some sense of out the memory settings to make Jenkins and its plugins happy?

is your jenkins running standalone (java -jar jenkins.war) or is it deployed as web container?

if jenkins is running as standalone you simply have to add the following parameters:

java -XX:MaxPermSize=512m -Xmx5120M -jar jenkins.war this will increase your PermGem to 512m and the heap to 5120M feel free to modify the values to your needs.

But i guess this would be too simple.. i guess jenkins is running als web container. in this case you have to change the start parameters of your web server.

If you are running a Tomcat you can add CATALINA_OPTS="-Xms512m -Xmx5000m -XX:MaxPermSize=512m" to the catalina.bat / or sh if running linux.

Or if directly installed via apt-get jenkins is launched via /etc/init.d/jenkins. Take a look in that file and try to find something like

export CATALINA_OPTS="-DJENKINS_HOME=$JENKINS_BASEDIR/jenkins-home -Xmx512m -Djava.awt.headless=true"

and add the parameters there. (i'm not sure how the file looks like so i can't tell you the exact line)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM