詹金斯中的堆空间错误

Posted

技术标签:

【中文标题】詹金斯中的堆空间错误【英文标题】:Heap Space Error in jenkins 【发布时间】:2014-08-13 02:33:20 【问题描述】:

我的詹金斯面临以下问题。如何摆脱这个错误?

状态码:500 例外:org.apache.commons.jelly.JellyTagException:jar:file:/C:/Program Files (x86)/Jenkins/war/WEB-INF/lib/jenkins-core-1.478.jar!/lib/layout/layout .jelly:91:72: Java 堆空间

堆栈跟踪:

javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/C:/Program Files (x86)/Jenkins/war/WEB-INF/lib/jenkins-core-1.478.jar!/lib/layout/layout.jelly:91:72: <st:include> Java heap space
    at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:112)
    at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:563)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:659)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:488)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:162)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:45)
    at winstone.ServletConfiguration.execute(ServletConfiguration.java:248)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:333)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:376)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:95)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:87)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:47)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:164)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:50)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at winstone.FilterConfiguration.execute(FilterConfiguration.java:194)
    at winstone.RequestDispatcher.doFilter(RequestDispatcher.java:366)
    at winstone.RequestDispatcher.forward(RequestDispatcher.java:331)
    at winstone.RequestHandlerThread.processRequest(RequestHandlerThread.java:215)
    at winstone.RequestHandlerThread.run(RequestHandlerThread.java:138)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/C:/Program Files (x86)/Jenkins/war/WEB-INF/lib/jenkins-core-1.478.jar!/lib/layout/layout.jelly:91:72: <st:include> Java heap space
    at org.apache.commons.jelly.impl.TagScript.handleException(TagScript.java:735)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:290)
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
    at org.apache.commons.jelly.tags.core.ForEachTag.doTag(ForEachTag.java:150)
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:270)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$1.run(CoreTagLibrary.java:98)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.CallTagLibScript.run(CallTagLibScript.java:119)
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
    at org.kohsuke.stapler.jelly.JellyViewScript.run(JellyViewScript.java:81)
    at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:63)
    at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:53)
    at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:107)
    ... 37 more
Caused by: java.lang.OutOfMemoryError: Java heap space

【问题讨论】:

【参考方案1】:

分配给 JVM 堆的默认内存量不足以满足您使用 Jenkins 的方式。某些事情会导致使用大量内存。

解决此问题的最简单方法是使堆变大并不断增加它,直到找到适合您的堆大小。

堆栈跟踪中的路径名看起来像 Windows 路径,所以也许您正在 Windows 上运行 Jenkins?可能this other *** thread 会告诉你如何增加堆大小的细节。

【讨论】:

以上是关于詹金斯中的堆空间错误的主要内容,如果未能解决你的问题,请参考以下文章

Jenkins 中的堆空间问题

sparklyr中的堆空间不足,但有足够的内存

詹金斯错误中的声纳扫描仪与任何配置的安装不匹配

使用 Quartz 调试 Groovy/Grails 应用程序中的堆空间问题

.NET - 存储在地址空间中的堆或堆栈上的函数变量?

jvm中的堆