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.(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 salve上 找到jenkins的安装目录下面的 jenkins-slave.xml 文件,  增加参数   '-Xmx1024m', 然后重启jenkin agent 服务,  修改参数后如下:
  C:\Program Files (x86)\Java80\jre\bin\java.exe
  -Xmx1024m -Xrs  -jar "%BASE%\slave.jar" -jnlpUrl http://9.xxx.xxx.xxx:8080/computer/fl_9.xxx.xxx.xxx/slave-agent.jnlp -secret 234a1%%#@%71c68449234ds733!@$#@5365be73672d494cb6a923f763ab216daa


你可能感兴趣的:(jenkins,jenkins)