jenkins 錯誤java.lang.OutOfMemoryError: Java heap space
阿新 • • 發佈:2019-01-01
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 salve上 找到jenkins的安裝目錄下面的 jenkins-slave.xml 檔案, 增加引數 '-Xmx1024m', 然後重啟jenkin agent 服務, 修改引數後如下: <executable>C:\Program Files (x86)\Java80\jre\bin\java.exe</executable> <arguments>-Xmx1024m -Xrs -jar "%BASE%\slave.jar" -jnlpUrl http://9.xxx.xxx.xxx:8080/computer/fl_9.xxx.xxx.xxx/slave-agent.jnlp -secret 234a1%%#@%[email protected]$#@5365be73672d494cb6a923f763ab216daa</arguments>