zoukankan      html  css  js  c++  java
  • Jenkins构建时报内存溢出错误java.lang.OutOfMemoryError: Java heap space

    Jenkins job 总是失败 即使执行的主体部分已经成功, log里面:

    Build step 'Execute Windows batch command' marked build as failure
    FATAL: Remote call on JNLP4-connect connection from 9.xxx.xxx.xxx/9.xxx.xxx.xxx:xxxxx failed
    java.lang.OutOfMemoryError: Java heap space
    	at java.lang.String.<init>(String.java:388)
    	at java.lang.String.substring(String.java:1372)
    	at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:144)
    	at org.jvnet.winp.WinProcess.getEnvironmentVariables(WinProcess.java:121)
    	at hudson.util.ProcessTree$WindowsOSProcess.getEnvironmentVariables2(ProcessTree.java:475)
    	at hudson.util.ProcessTree$WindowsOSProcess.hasMatchingEnvVars2(ProcessTree.java:487)
    	at hudson.util.ProcessTree$WindowsOSProcess.access$300(ProcessTree.java:410)
    	at hudson.util.ProcessTree$Windows.hasMatchingEnvVars(ProcessTree.java:561)
    	at hudson.util.ProcessTree$Windows.killAll(ProcessTree.java:536)
    	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:996)
    	at hudson.Launcher$RemoteLauncher$KillTask.call(Launcher.java:987)
    	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
    	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
    	at hudson.remoting.Request$2.run(Request.java:336)
    	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:277)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    	at hudson.remoting.Engine$1$1.run(Engine.java:94)
    	at java.lang.Thread.run(Thread.java:785)
    	at ......remote call to JNLP4-connect connection from 9.xxx.xxx.xxx/9.xxx.xxx.xxx:xxxxx(Native Method)
    	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1545)
    	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
    	at hudson.remoting.Channel.call(Channel.java:830)
    Caused: java.io.IOException: Remote call on JNLP4-connect connection from 9.xxx.xxx.xxx/9.xxx.xxx.xxx:xxxxx failed
    	at hudson.remoting.Channel.call(Channel.java:838)
    	at hudson.Launcher$RemoteLauncher.kill(Launcher.java:984)
    	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:540)
    	at hudson.model.Run.execute(Run.java:1735)
    	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    	at hudson.model.ResourceController.execute(ResourceController.java:97)
    	at hudson.model.Executor.run(Executor.java:405)
    Finished: FAILURE
    
    解决办法(亲测有效):
    安装jenkins的window服务器上 找到jenkins的安装目录下面的 jenkins.xml 文件,将参数-Xmx256m 修改为-Xmx1024m,然后重启jenkin服务,修改参数后如下:
    <executable>%BASE%jreinjava</executable>
    <arguments>-Xrs -Xmx1024m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%jenkins.war" --httpPort=8080 --webroot="%BASE%war"</arguments>

    网上看到的其它解决方法:

       Jenkins->系统管理->系统设置->Global properties
       环境变量新增配置:
       MAVEN_OPTS
       -Xmx480m -XX:MaxPermSize=512m

       

     
  • 相关阅读:
    Map集合的四种遍历方式
    测试框架:使用SONAR分析代码质量
    什么是蓝绿发布
    linux命令(mac)
    TestNG.xml大全
    Mac端git新增项目
    JavascriptExecutor的UI自动化实战
    git命令及Maven命令
    UI自动化常用代码
    USACO 1.3 Ski Course Design
  • 原文地址:https://www.cnblogs.com/li150dan/p/13746289.html
Copyright © 2011-2022 走看看