We are seeing intermittent failures of our maven builds for a particular project caused by memory issues. The following error log falls out on the last component that is compiled in the project:
build 18-Nov-2013 09:10:10 [INFO] -------------------------------------------------------------
build 18-Nov-2013 09:10:10 [ERROR] COMPILATION ERROR :
build 18-Nov-2013 09:10:10 [INFO] -------------------------------------------------------------
build 18-Nov-2013 09:10:10 [ERROR] Failure executing javac, but could not parse the error:
build 18-Nov-2013 09:10:10
build 18-Nov-2013 09:10:10
build 18-Nov-2013 09:10:10 The system is out of resources.
build 18-Nov-2013 09:10:10 Consult the following stack trace for details.
build 18-Nov-2013 09:10:10 java.lang.OutOfMemoryError: PermGen space
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.comp.Check.<init>(Check.java:836)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.comp.Check.instance(Check.java:86)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.code.Types.<init>(Types.java:101)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.code.Types.instance(Types.java:88)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.jvm.ClassReader.<init>(ClassReader.java:264)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.jvm.ClassReader.instance(ClassReader.java:226)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.main.JavaCompiler.<init>(JavaCompiler.java:331)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.main.JavaCompiler.instance(JavaCompiler.java:88)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.main.Main.compile(Main.java:424)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.main.Main.compile(Main.java:353)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.main.Main.compile(Main.java:342)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.main.Main.compile(Main.java:333)
build 18-Nov-2013 09:10:10 at com.sun.tools.javac.Main.compile(Main.java:94)
build 18-Nov-2013 09:10:10 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
build 18-Nov-2013 09:10:10 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
build 18-Nov-2013 09:10:10 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
build 18-Nov-2013 09:10:10 at java.lang.reflect.Method.invoke(Method.java:606)
build 18-Nov-2013 09:10:10 at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:554)
build 18-Nov-2013 09:10:10 at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:161)
build 18-Nov-2013 09:10:10 at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:605)
build 18-Nov-2013 09:10:10 at org.apache.maven.plugin.TestCompilerMojo.execute(TestCompilerMojo.java:161)
build 18-Nov-2013 09:10:10 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
build 18-Nov-2013 09:10:10 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
build 18-Nov-2013 09:10:10 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
build 18-Nov-2013 09:10:10 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
build 18-Nov-2013 09:10:10 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
We are running Bamboo 4.4.4 build 3506 with the following Maven and Java versions:
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /usr/share/maven3
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-53-generic", arch: "amd64", family: "unix"
The contents of our wrapper.conf file are attached. I've tried rebuilding a number of times but the system seems to be stuck on lack of resources. Here is a "free -m" output from the Ubuntu server running our Bamboo:
total used free shared buffers cached
Mem: 32173 27268 4904 0 530 20528
-/+ buffers/cache: 6209 25964
Swap: 17409 19 17390
Thanks Przemek! I am aware of the info in the link you sent me but did not know how to apply it properly in Bamboo so was looking moreso for a clear Bamboo solution for this. Under the "Maven 3.x" build task, I saw a field called "Environment Variables" in the configuration of that task so that is where I put my MAVEN_OPTS. Here is what I chose to enter into that field:
MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
So far, so good - the last two builds have not run out of memory for that project, but it would be nice to see a recommendation from Atlassian on what MaxPermSize to set in relation to total memory allocations i.e. some percentage of the total memory on the server or whatever since this will more than likely come out of the JVM size for Bamboo itself. Might I suggest that the use of the "Environment Variables" field for the Maven 3.x task be at least one way that is Bamboo-centric and can be put on the Bamboo support pages for running out of memory (which currently only point to doing something general with MAVEN_OPTS but do not say where or how to do that). The StackOverFlow link you sent me is not about Bamboo but does contain the info needed to set MAVEN_OPTS in general. Users are looking for specific formats and where to put them.
Thanks for the reply!
Mo