我的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
我尝试将-Xmx和-Xms添加到VM中(如您所见),但这也不起作用......某人有想法会在那里发生吗?
答案 0 :(得分:0)
问题是由于Jenkins未能保留足够的堆空间来启动maven构建。根据你的说法,似乎很少有东西可以分享你的VM限制,(我包括了运行每个进程所需的内存估计)
我的内存估计相当保守,但是,它很容易加起来超过1GB,这使得Jenkins的可用堆保留到小于Xms(512m),因此,未能启动构建
理想情况下,您应该将VM上的softlimit增加到更高的值。如果这不可行,我的建议是通过将Jenkins中的作业配置改为这样的(Xmx512m,Xms128m)来减少构建的内存管理,这样Jenkins就可以启动只有128m可用堆的构建。但是,当构建需要一个低于Xmx但高于可用堆的堆时,此设置可能会导致后期出现内存不足错误。
或者,您可以内存管理我上面提到的其他进程,或者您可以设置一些配置虚拟机上的虚拟内存。