Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-14032

java.lang.OutOfMemoryError: PermGen space Errors When Compiling with Maven in Bamboo Project

    • Icon: Bug Bug
    • Resolution: Answered
    • Icon: Low Low
    • None
    • 4.4.4
    • Maven
    • None

      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

            [BAM-14032] java.lang.OutOfMemoryError: PermGen space Errors When Compiling with Maven in Bamboo Project

            Monique Khairuliana (Inactive) made changes -
            Workflow Original: Bamboo Workflow 2016 v1 - Restricted [ 1441771 ] New: JAC Bug Workflow v3 [ 3384360 ]
            Status Original: Resolved [ 5 ] New: Closed [ 6 ]
            Owen made changes -
            Workflow Original: Bamboo Workflow 2016 v1 [ 1417970 ] New: Bamboo Workflow 2016 v1 - Restricted [ 1441771 ]
            Marek Went (Inactive) made changes -
            Workflow Original: Bamboo Workflow 2014 v2 [ 607233 ] New: Bamboo Workflow 2016 v1 [ 1417970 ]
            James Dumay made changes -
            Workflow Original: Bamboo Workflow 2014 [ 595089 ] New: Bamboo Workflow 2014 v2 [ 607233 ]
            James Dumay made changes -
            Workflow Original: Bamboo Workflow 2010 [ 583980 ] New: Bamboo Workflow 2014 [ 595089 ]
            James Dumay made changes -
            Component/s New: Maven [ 13073 ]

            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

            Maurice Romaniuk added a comment - 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
            Przemek Bruski made changes -
            Resolution New: Answered [ 9 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]

            It's not Bamboo that's running out of memory, it's Maven. You need to increase permgen for maven. You need to set MAVEN_OPTS in your Maven task. See here for more info:
            http://stackoverflow.com/questions/3101128/java-lang-outofmemoryerror-permgen-space

            Przemek Bruski added a comment - It's not Bamboo that's running out of memory, it's Maven. You need to increase permgen for maven. You need to set MAVEN_OPTS in your Maven task. See here for more info: http://stackoverflow.com/questions/3101128/java-lang-outofmemoryerror-permgen-space
            Maurice Romaniuk created issue -

              Unassigned Unassigned
              8acb7cc97ea1 Maurice Romaniuk
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: