Spring Tool Suite
  1. Spring Tool Suite
  2. STS-2129

Grails 2.0.0.M1 and M2 Out of Memory (PermGen) using run-app in STS

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.8.0.M1, 2.8.0.M2
    • Fix Version/s: 2.8.0.RC1
    • Component/s: GRAILS
    • Labels:
      None
    • Environment:

      Win 7 64bit, Grails 2.0.0.M1 and Grails 2.0.0.M2, STS 1.8

      Description

      When running my app in STS 1.8 with a Grails 2.0.0M1 or M2. I keep getting an out of memory (permGen) error. On inspection, I see:
      jvm_args: -XX:MaxPermSize=96m is the settings used.

      I initially raised this issue on the Grails Jira but I compared it with launching in command prompt and not getting any of these errors leads this to an STS issue. Please see Graeme Rocher's comments below:
      http://jira.grails.org/browse/GRAILS-7816

      This previous issues:
      https://issuetracker.springsource.com/browse/STS-1785
      Shows that the Max PermGem memory was raised however we seem to be back to 96Mb on STS 1.8.

      Here is the result of run-app in STS:

      Loading Grails 2.0.0.M2
      Configuring classpath
      Configuring classpath.
      Environment set to development
      Environment set to development.
      Environment set to development..
      Environment set to development...
      Environment set to development....
      Environment set to development.....
      Packaging Grails application
      Packaging Grails application.
      Packaging Grails application..
      Packaging Grails application...
      Packaging Grails application....
      Compiling 3 source files
      Compiling 3 source files.
      Compiling 3 source files..
      Compiling 3 source files...
      Compiling 3 source files....
      Compiling 3 source files.....
      Running Grails application
      Server running. Browse to http://localhost:8080/XXX
      Error 2011-09-25 23:48:55,920 ["http-bio-8080"-exec-6] ERROR filter.UrlMappingsFilter - Error when matching URL mapping [/(*)/(*)?/(*)?]:null
      Line
      Method
      ->> 886
      runTask in java.util.concurrent.ThreadPoolExecutor$Worker
      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      908 run in ''
      ^ 662
      run . . in java.lang.Thread
      Error 2011-09-25 23:49:09,575 ["http-bio-8080"-exec-5] ERROR errors.GrailsExceptionResolver - NoClassDefFoundError occurred when processing request: [GET] /XXX/dashboard/jjj
      Could not initialize class org.jfree.chart.JFreeChart. Stacktrace follows:
      Line
      Method
      ->> 886
      runTask in java.util.concurrent.ThreadPoolExecutor$Worker
      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      908 run in ''
      ^ 662
      run . . in java.lang.Thread

      Caused by ControllerExecutionException: Runtime error executing action
      ->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        908 run in ''
        ^ 662
        run . . in java.lang.Thread

      Caused by InvocationTargetException: null
      ->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        908 run in ''
        ^ 662
        run . . in java.lang.Thread

      Caused by NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart
      ->> 338 | createPieChart in org.jfree.chart.ChartFactory

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        303 doCall in XXX.DashboardController$_closure5
        886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
        908 run in ''
        ^ 662
        run . . in java.lang.Thread
        Error 2011-09-25 23:49:09,619 ["http-bio-8080"-exec-3] ERROR errors.GrailsExceptionResolver - OutOfMemoryError occurred when processing request: [GET] /XXX/dashboard/yyy
        PermGen space. Stacktrace follows:
        Line
        Method
        ->> 886
        runTask in java.util.concurrent.ThreadPoolExecutor$Worker
      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        908 run in ''
        ^ 662
        run . . in java.lang.Thread

      Caused by ControllerExecutionException: Runtime error executing action
      ->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        908 run in ''
        ^ 662
        run . . in java.lang.Thread

      Caused by InvocationTargetException: null
      ->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        908 run in ''
        ^ 662
        run . . in java.lang.Thread

      Caused by OutOfMemoryError: PermGen space
      ->> 631 | defineClassCond in java.lang.ClassLoader

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        615 defineClass in ''
        141 defineClass in java.security.SecureClassLoader
        283 defineClass in java.net.URLClassLoader
        58 access$000 in ''
        197 run in java.net.URLClassLoader$1
        190 findClass in java.net.URLClassLoader
        306 loadClass in java.lang.ClassLoader
        247 loadClass in ''
        ^ 101
        doCall in XXX.DashboardController$_closure3
        Error 2011-09-25 23:49:30,739 ["http-bio-8080"-exec-3] ERROR [/XXX].[default] - Servlet.service() for servlet [default] in context with path [/XXX] threw exception
        Line
        Method
        ->> 251
        doAppend in org.apache.log4j.AppenderSkeleton
      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        66 appendLoopOnAppenders in org.apache.log4j.helpers.AppenderAttachableImpl
        206 callAppenders . . . . in org.apache.log4j.Category
        391 forcedLog in ''
        856 log . . . . . . . . . in ''
        257 error in org.apache.juli.logging.impl.Log4JLogger
        886 runTask . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
        908 run in ''
        ^ 662
        run . . . . . . . . . in java.lang.Thread
        Error 2011-09-25 23:49:36,216 ["http-bio-8080"-exec-3] ERROR servlet.ErrorHandlingServlet - Problem instantiating StackTraceFilterer class, using default: PermGen space
        Error 2011-09-25 23:49:39,570 ["http-bio-8080"-exec-3] ERROR servlet.ErrorHandlingServlet - Problem instantiating StackTraceFilterer class, using default: PermGen space
        Error 2011-09-25 23:49:44,915 ["http-bio-8080"-exec-3] ERROR servlet.ErrorHandlingServlet - Problem instantiating StackTraceFilterer class, using default: PermGen space

        Activity

        Hide
        Kris De Volder (c) added a comment -

        I'll look into it shortly. However, just wanted to clarify that the permgen in issue
        https://issuetracker.springsource.com/browse/STS-1785

        is the settings for running STS itself has nothing todo with the permgen setting for running Grails from STS (Grails commands are run in a separate/external process and have their own setting.

        Anyhow... I'll investigate and check what permgen (and other VM params) the commandline tools are using and copy those for our runners.

        Show
        Kris De Volder (c) added a comment - I'll look into it shortly. However, just wanted to clarify that the permgen in issue https://issuetracker.springsource.com/browse/STS-1785 is the settings for running STS itself has nothing todo with the permgen setting for running Grails from STS (Grails commands are run in a separate/external process and have their own setting. Anyhow... I'll investigate and check what permgen (and other VM params) the commandline tools are using and copy those for our runners.
        Hide
        Kris De Volder (c) added a comment -

        startGrails script in Grails 2.0.0.M2 and also the one in Grails 1.3.7 use these options for launching Grails processes:

        -server -Xmx512M -XX:MaxPermSize=192m

        I've bumped up our launcher's settings to also use 192m as the default. Now the default memory settings exactly match those of the CL tools.

        Note that it will only use these default setting if the launch configuration itself does not specify a value of its own.

        Show
        Kris De Volder (c) added a comment - startGrails script in Grails 2.0.0.M2 and also the one in Grails 1.3.7 use these options for launching Grails processes: -server -Xmx512M -XX:MaxPermSize=192m I've bumped up our launcher's settings to also use 192m as the default. Now the default memory settings exactly match those of the CL tools. Note that it will only use these default setting if the launch configuration itself does not specify a value of its own.
        Hide
        Henry Zaccak added a comment -

        Hi Kris, How can I manually set the launch config to use 192m (while I wait for the next release of STS)?

        Show
        Henry Zaccak added a comment - Hi Kris, How can I manually set the launch config to use 192m (while I wait for the next release of STS)?
        Hide
        Kris De Volder (c) added a comment -

        When you do 'Run As >> Grails Command (Run App|Test-app). A default launch configuration is only created if it doesn't already exist. You can find that configuration via the "Run" menu.

        Go to "Run >> Run Configuration >> Grails". There you should find existing Grails run configurations. You can open and edit them.

        If you add your custom VM args in a conf there the next time you run that particular conf via the run as menu, it should use your customized settings instead of default ones.

        Show
        Kris De Volder (c) added a comment - When you do 'Run As >> Grails Command (Run App|Test-app). A default launch configuration is only created if it doesn't already exist. You can find that configuration via the "Run" menu. Go to "Run >> Run Configuration >> Grails". There you should find existing Grails run configurations. You can open and edit them. If you add your custom VM args in a conf there the next time you run that particular conf via the run as menu, it should use your customized settings instead of default ones.
        Hide
        Facundo D added a comment -

        @Kris: Is there a way to manually set the JVM parameters that STS "will" use to run grails commands? I'm trying "refresh dependencies" in order to resolve some project dependencies and cannot reproduce it by using a Run Configuration...

        Show
        Facundo D added a comment - @Kris: Is there a way to manually set the JVM parameters that STS "will" use to run grails commands? I'm trying "refresh dependencies" in order to resolve some project dependencies and cannot reproduce it by using a Run Configuration...
        Hide
        Kris De Volder (c) added a comment -

        Unfortunately, I don't think that you can change the options passed for 'refresh dependencies'. It doesn't use a saved launch configuration. This means it will always use the default set of options which are 'baked in'.

        I suggest you upgrade to 2.8.0 which is out now.

        One word of warning though. If you are using maven projects the upgrade may cause you grief. So read this FAQ before deciding to upgrade http://forum.springsource.org/showthread.php?116189-STS-2.8.0-and-m2e-FAQ

        Show
        Kris De Volder (c) added a comment - Unfortunately, I don't think that you can change the options passed for 'refresh dependencies'. It doesn't use a saved launch configuration. This means it will always use the default set of options which are 'baked in'. I suggest you upgrade to 2.8.0 which is out now. One word of warning though. If you are using maven projects the upgrade may cause you grief. So read this FAQ before deciding to upgrade http://forum.springsource.org/showthread.php?116189-STS-2.8.0-and-m2e-FAQ
        Hide
        Kris De Volder (c) added a comment -

        You have a good point, it really should be possible to change those defaults if they do not work for you so I've raised:

        https://issuetracker.springsource.com/browse/STS-2204

        Unfortunately this will not help you right now.

        Show
        Kris De Volder (c) added a comment - You have a good point, it really should be possible to change those defaults if they do not work for you so I've raised: https://issuetracker.springsource.com/browse/STS-2204 Unfortunately this will not help you right now.
        Hide
        Facundo D added a comment -

        1. Downloading 2.8 right now
        2. Your responsiveness and kind response is greately apreciated... I'll keep a watch on the issue you just created

        Cheers!

        Show
        Facundo D added a comment - 1. Downloading 2.8 right now 2. Your responsiveness and kind response is greately apreciated... I'll keep a watch on the issue you just created Cheers!

          People

          • Assignee:
            Kris De Volder (c)
            Reporter:
            Henry Zaccak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date: