Jenkins-java.lang.OutOfMemoryError:PermGen空间- [英] Jenkins - java.lang.OutOfMemoryError: PermGen space -

查看:162
本文介绍了Jenkins-java.lang.OutOfMemoryError:PermGen空间-的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境:Linux/Windows7,Java 1.6.0.03/37或1.7

Environment: Linux/Windows7, Java 1.6.0.03/37 or 1.7

我下载了jenkins.war,并使用以下脚本/命令进行了初始设置后,我下载了一些插件(10-15),并尝试重新启动Jenkins,它起作用了.然后,我得到了更多的插件(总共30-40个),并且选择了Install或download + then + install,Jenkins却没有出现.

I downloaded jenkins.war and after the initial setup using the following script/command, I downloaded some plugins(10-15) and tried to restart Jenkins, it worked. Then, I got some more plugins (30-40 in total) and either I chose Install or download+then+install, Jenkins didn't come up.

即使用startJenkins.sh(仅Linux).注意:在Windows7上,Jenkins作为Windows服务启动.

i.e. using startJenkins.sh (Linux only). Note: On Windows7 Jenkins started as a Windows service.

#!/bin/bash
export JAVA_HOME=/production/jenkinsAKS/java/jdk1.6.0_03
export JENKINS_HOME=/production/jenkinsAKS
export PATH=${JAVA_HOME}/bin:${PATH}
export JENKINS_HTTP_PORT=9040
export JENKINS_AJP13_PORT=9949
now=`date +%Y%m%d_%H%M%S`

echo  $0 begins ${now}
echo "   java-home=${JAVA_HOME}, jenkins-home=${JENKINS_HOME}, path=${PATH}"
java -jar ${JENKINS_HOME}/lib/jenkins.war -XX:MaxPermSize=4096m --logfile=${JENKINS_HOME}/log/jenkins.log${now} --httpPort=${JENKINS_HTTP_PORT} --ajp13Port=${JENKINS_AJP13_PORT} &

最初,我没有使用"-XX:MaxPermSize = 4096m"参数,但是当我看到以下错误消息时,我尝试使用各种值,例如128/512/1024,2048,4096m等,对错误.

Initially I didn't use "-XX:MaxPermSize=4096m" parameter but as soon as I saw the following error message, I tried various values like 128/512/1024,2048,4096m etc, didn't help with the error.

INFO: Beginning extraction from war file
Jenkins home directory: /production/jenkinsAKS found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: HTTP Listener started: port=9040
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: AJP13 Listener started: port=9949
Aug 1, 2013 1:17:15 PM winstone.Logger logInternal
INFO: Winstone Servlet Engine v0.9.10 running: controlPort=disabled
Aug 1, 2013 1:17:16 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Aug 1, 2013 1:17:16 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Aug 1, 2013 1:17:16 PM hudson.plugins.ansicolor.PluginImpl start
INFO: AnsiColor: eliminating boring output (https://github.com/dblock/jenkins-ansicolor-plugin)
Aug 1, 2013 1:17:16 PM org.jvnet.hudson.plugins.backup.BackupPluginImpl loadConfiguration
INFO: Loading configuration...
Aug 1, 2013 1:17:16 PM org.jvnet.hudson.plugins.backup.utils.BackupPersistence loadConfig
INFO: Config file not found.
Aug 1, 2013 1:17:18 PM ruby.RubyRuntimePlugin start
INFO: Injecting JRuby into XStream
Trying to load models from /production/jenkinsAKS/plugins/pathignore/WEB-INF/classes/models
Loading /production/jenkinsAKS/plugins/pathignore/WEB-INF/classes/models/pathignore_wrapper.rb
Aug 1, 2013 1:17:26 PM hudson.plugins.greenballs.PluginImpl start
INFO: Green Balls!
Aug 1, 2013 1:17:26 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Aug 1, 2013 1:17:32 PM hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error
WARNING: Failed to instantiate optional component org.jfrog.hudson.ivy.ArtifactoryIvyConfigurator$DescriptorImpl; skipping
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Aug 1, 2013 1:17:32 PM hudson.plugins.scm_sync_configuration.ScmSyncConfigurationBusiness queueChangeSet
INFO: Queue of changeset     A hudson.model.UpdateCenter.xml
 aborted (scm manipulator not settled !)
Aug 1, 2013 1:17:32 PM org.jenkinsci.main.modules.sshd.SSHD start
INFO: Started SSHD at port 36227
Aug 1, 2013 1:17:32 PM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Aug 1, 2013 1:17:32 PM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 46056
The following triggers are available for your jobs
[Trigger] - Build periodically
[Trigger] - Build when another project is promoted
[Trigger] - Maven Dependency Update Trigger
[Trigger] - Poll SCM
[Trigger] - [BuildResultTrigger] - Monitor build results of other jobs
[Trigger] - [FSTrigger] - Monitor files
[Trigger] - [FSTrigger] - Monitor folder
[Trigger] - [IvyTrigger] - Poll with an Ivy script
[Trigger] - [ScriptTrigger] - Poll with a Groovy script
[Trigger] - [ScriptTrigger] - Poll with a shell or batch script
[Trigger] - [URLTrigger] - Poll with a URL
Aug 1, 2013 1:17:33 PM hudson.WebAppMain$2 run
INFO: Jenkins is fully up and running
Exception in thread "Jenkins cron thread" java.lang.OutOfMemoryError: PermGen space
Exception in thread "JmDNS(sagrdev3sb12.local.).State.Timer" java.lang.OutOfMemoryError: PermGen space
Exception in thread "ConnectorThread:[http-9040]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "JmDNS(sagrdev3sb12.local.).Timer" java.lang.OutOfMemoryError: PermGen space
Exception in thread "WinstoneHostConfigurationMgmt:default" java.lang.OutOfMemoryError: PermGen space

有时我会看到:

    30  Aug 1, 2013 1:50:29 AM jenkins.InitReactorRunner$1 onAttained
    31  INFO: Prepared all plugins
    32  Exception in thread "pool-2-thread-20" java.lang.OutOfMemoryError: PermGen space
    33  Aug 1, 2013 1:51:10 AM winstone.Logger logInternal
    34  WARNING: Untrapped Error in Servlet
    35  java.lang.OutOfMemoryError: PermGen space
    36  Aug 1, 2013 1:51:12 AM winstone.Logger logInternal
    37  SEVERE: Error in the error servlet
    38  java.lang.OutOfMemoryError: PermGen space
    39  Exception in thread "Jenkins cron thread" java.lang.OutOfMemoryError: PermGen space
-bash-3.2$

如何解决此问题?当我在Windows台式机上进行相同的练习时,也会出现相同的问题.我需要使用更少或数量有限的插件吗?

How can I resolve this issue? The same issue came up when I did the same exercise on my Windows desktop machine. Do I need to use less or a limited number of plugins?

谢谢

推荐答案

在我的〜/.bash_profile文件中,设置了以下3个变量.请注意,此文件中还有其他变量,即JAVA_HOME,ANT_HOME,SONAR_HOME,SONAR_RUNNER_HOME等:

In my ~/.bash_profile file, I have set the following 3 variables. Note there are other variables in this file as well i.e. JAVA_HOME, ANT_HOME, SONAR_HOME, SONAR_RUNNER_HOME, etc:

export JAVA_OPTS="-XX:MaxPermSize=512m -Xms512m -Xmx1024m"
export GRADLE_OPTS="-XX:MaxPermSize=512m"
export SONAR_RUNNER_OPTS="-Xmx512m -XX:MaxPermSize=512m"

全部-现在工作.

第一行导出:将使Jenkins正常运行,而不会出现PermGen错误,第二行将在Jenkins调用Gradle脚本(通过另一个包装器脚本,例如.sh/etc)时使Gradle运行,第三行使声纳运行器"命令运行正常(否则,在sonar-runner命令输出期间,在"Initialize Hibernate" ...行之后出现PermGen错误).您可以在已编译Java,与静态代码分析工具相关的报告(pmd/checkstyle/findbugs)和其他代码覆盖率报告(jacoco/cobertura)的工作空间中运行sonar-runner命令.工作区应具有"sonar-project.properties"文件.查找有关此文件以及项目中包含的所有变量的SonarQube帮助页面.

The first export line: will get Jenkins going without PermGen error, the 2nd line will make Gradle going when Jenkins calls Gradle script (via a another wrapper script for ex. .sh/etc), third line makes "sonar-runner" command to work fine (otherwise, I was getting an error for PermGen after "Initialize Hibernate"... line during sonar-runner command's output). You run sonar-runner command in the workspace where you have compiled java, reports related to static code analysis tools (pmd/checkstyle/findbugs) and other code coverage reports (jacoco/cobertura). Workspace should have "sonar-project.properties" file. Look for SonarQube help pages about this file and what all variables it contains for a project.

所有这些选项记录在这里: http://docs.oracle.com/javase/8/docs/technotes/工具/windows/java.html 或者如果您使用的是Java 7,则在这里: http://docs.oracle.com/javase/7/docs/technotes/工具/windows/java.html

All those options are documented here: http://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html or here if you are using Java 7: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html

这篇关于Jenkins-java.lang.OutOfMemoryError:PermGen空间-的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆