Hudson构建总是以“java.lang.OutOfMemoryError:Java堆空间”错误结束

时间:2010-10-08 06:57:30

标签: java hudson

我遇到了Hudson构建奴隶的问题,它有Windows XP和4 GB RAM,并且在批处理文件中调用JNLP我已经指定如下:

  

javaws -J-Xms1280m -J-Xmx1024m http://hudson-master.domain.com:8080/computer/Exige/slave-agent.jnlp

为什么我不能给它超过1 GB?

The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
        at com.sun.tools.javac.util.List.prepend(List.java:145)
        at com.sun.tools.javac.jvm.ClassReader.openArchive(ClassReader.java:1457)
        at com.sun.tools.javac.jvm.ClassReader.list(ClassReader.java:1742)
        at com.sun.tools.javac.jvm.ClassReader.listAll(ClassReader.java:1882)
        at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1903)
        at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1538)
        at com.sun.tools.javac.code.Symbol.complete(Symbol.java:355)
        at com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:256)
        at com.sun.tools.javac.tree.Tree$TopLevel.accept(Tree.java:382)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:221)
        at com.sun.tools.javac.comp.Enter.classEnter(Enter.java:235)
        at com.sun.tools.javac.comp.Enter.complete(Enter.java:448)
        at com.sun.tools.javac.comp.Enter.main(Enter.java:433)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:404)
        at com.sun.tools.javac.main.Main.compile(Main.java:592)
        at com.sun.tools.javac.main.Main.compile(Main.java:544)
        at com.sun.tools.javac.Main.compile(Main.java:85)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:420)
        at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:141)
        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
        at hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:182)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------
[INFO] Total time: 34 seconds
[INFO] Finished at: Fri Oct 08 17:27:59 EST 2010 [INFO] Final Memory: 25M/63M [INFO] ------------------------------------------------------------------------

4 个答案:

答案 0 :(得分:4)

Xms通常应低于Xmx

答案 1 :(得分:3)

构建是否直接由从属代理的JVM执行?如果您运行Maven构建(例如),则从属代理可以启动外部Maven进程(使用默认的Java Xmx)。

因此,您应指定MAVEN_OPTS参数,以确保始终使用自定义的Xmx值执行Maven构建。

答案 2 :(得分:1)

如果你有Master Slave配置,你应该在Manage Hudson-> Configure system-> Global properties

中指定内存设置

Master上存在的环境属性也在Slave中使用。

答案 3 :(得分:1)

请注意:在32位Windows上,Java VM的分配不能超过1 GB。不要问我原因,但情况就是如此(至少是Sun JVM的情况)。如果需要更多JVM内存,则需要64位系统。当然还有一个64位的JVM。