Senior Systems Engineer
Senior Systems Engineer

Reputation: 1139

Hudson build always end up in "java.lang.OutOfMemoryError: Java heap space" error

I'm having a problem with the Hudson build slave which has got Windows XP and 4 GB RAM and in the batch file to call the JNLP I have specify like the following:

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

Why can't I give it more than 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] ------------------------------------------------------------------------

Upvotes: 3

Views: 7407

Answers (4)

Pushpinder Rattan
Pushpinder Rattan

Reputation: 172

If you have Master Slave configuration, you should specify the memory settings in the Manage Hudson->Configure system->Global properties

The kind of Environment properties present on Master are used in Slave too.

Upvotes: 1

Marcel Schoen
Marcel Schoen

Reputation: 11

Please note: On 32-bit Windows, a Java VM cannot allocate more than about 1 GB. Don't ask me why, but that's the case (at least it's the case for the Sun JVM). You need a 64 bit system if you need more memory for your JVM. And a 64-bit JVM, of course.

Upvotes: 1

Bozho
Bozho

Reputation: 597076

The Xms should generally be lower than the Xmx

Upvotes: 4

Benoit Courtine
Benoit Courtine

Reputation: 7064

Is the build executed directly by the JVM of the slave agent? If you run a Maven build (for example), the slave agent can launch an external Maven process (with default Java Xmx).

So you should specify the MAVEN_OPTS parameter to ensure that Maven builds are always executed with a customized Xmx value.

Upvotes: 3

Related Questions