简体   繁体   English

Jenkins Server无法编译,因为无法保留堆空间

[英]Jenkins Server cannot compile because no heap space could reserved

I have a big problem with my jenkins server: I Cant build a maven project, because the java vm cannot start: 我的jenkins服务器有一个大问题:我无法构建一个Maven项目,因为Java vm无法启动:

Checkout:workspace / /var/lib/jenkins/jobs/SchwarzGoldTool/workspace - hudson.remoting.LocalChannel@b7193fc
Using strategy: Default
Last Built Revision: Revision c2d18fd7a5d7f112163e9440a8e7256a44e32f46 (origin/HEAD, origin/master)
Checkout:workspace / /var/lib/jenkins/jobs/SchwarzGoldTool/workspace - hudson.remoting.LocalChannel@b7193fc
Fetching changes from 1 remote Git repository
Fetching upstream changes from git://.../tsc.git
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Commencing build of Revision 2b4654302e8222509db5808c9071ec95daf0b495 (origin/HEAD, origin/master)
Checking out Revision 2b4654302e8222509db5808c9071ec95daf0b495 (origin/HEAD, origin/master)
Warning : There are multiple branch changesets here
Parsing POMs
Modules changed, recalculating dependency graph
[SchwarzGoldTool] $ java -Xmx512M -Xms512M -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/var/lib/jenkins/tools/Maven_3.0.3/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /var/lib/jenkins/tools/Maven_3.0.3 /var/run/jenkins/war/WEB-INF/lib/remoting-2.11.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 58359
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
ERROR: Failed to launch Maven. Exit code = 1
Finished: FAILURE

I tried to add -Xmx and -Xms to the VM (as you can see) but that doesnt work either... someone has a idea whats going on there? 我试图将-Xmx和-Xms添加到VM(如您所见),但这也不起作用...某人知道那里发生了什么?

The problem is caused by Jenkins failed to reserve enough heap space to kick off a maven build. 该问题是由于詹金斯未能保留足够的堆空间来启动Maven构建引起的。 From what you said, it seems like there are few things which share your VM limit, (I included the estimation of the memory required to run each process) 从您所说的来看,似乎很少有东西可以共享您的VM限制,(我包括了运行每个进程所需的内存的估计)

  • The VM's OS (~200~300mb) VM的操作系统(〜200〜300mb)
  • Jenkins (~min 256mb) 詹金斯(〜min 256mb)
  • Webcontainers (~256~512mb) Web容器(〜256〜512mb)
  • etc. (~100mb) 等(〜100mb)

My memory estimation is rather conservative, but still, it's easily adds up to over 1gb, which leave the available heap for Jenkins to reserve to less than the Xms (512m), hence, failed to kick off a build 我的内存估计是相当保守的,但是仍然很容易总计超过1gb,这使Jenkins保留的可用堆少于Xms(512m),因此无法启动构建

Ideally you should increase the softlimit on your VM to a higher value. 理想情况下,您应该将VM的软限制增加到更高的值。 If that is not feasible, my advice will be to reduce the memory management of the build by change the job configuration in Jenkins to something like this, (Xmx512m, Xms128m) so that Jenkins can kick off a build with only 128m free heap. 如果那不可行,我的建议是通过将Jenkins中的作业配置更改为这样的东西(Xmx512m,Xms128m)来减少构建的内存管理,以便Jenkins可以仅用128m可用堆启动构建。 But this setting may cause out of memory error in the later stage, when the build required a heap which is below Xmx but above the available heap. 但是,此设置在以后的阶段可能会导致内存不足错误,因为生成所需的堆低于Xmx但高于可用堆。

Alternatively, you can memory manage other processes I mentioned above or you can setup some configure the virtual memory on your VM. 另外,您可以内存管理上面提到的其他进程,也可以在VM上设置一些配置虚拟内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM