Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0.1
-
Component/s: None
-
Labels:None
Description
Create an app and change the servlet spec from 2.5 to 3.0 in BuildConfig.groovy. Run 'grails run-app' and it crashes with "Error Error executing script RunApp: PermGen space" (even with GRAILS_OPTS set to "-server -Xmx1G -XX:MaxPermSize=500m -Dfile.encoding=UTF-8"
'grails prod run-war' behaves differently - it appears to hang at "Running Grails application" but then fails with "Error Tomcat failed to start the app in 300 seconds (see output in ...)"
If you look at target/tomcat-err.txt there's this exception (which is http://jira.codehaus.org/browse/GROOVY-4673):
"java.lang.ClassFormatError: Illegal class name "groovy/jmx/builder/package-info" in class file groovy/jmx/builder/package-info"
and that's followed by
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space at java.lang.ClassLoader.defineClass1(Native Method) ...
-
Hide
- asynctest-bug-report-06092011.zip
- 06/Sep/11 2:46 AM
- 21 kB
- Graeme Rocher
-
- grails-app/conf/BootStrap.groovy 0.1 kB
- grails-app/conf/BuildConfig.groovy 2 kB
- grails-app/conf/Config.groovy 4 kB
- grails-app/conf/DataSource.groovy 1 kB
- grails-app/conf/UrlMappings.groovy 0.2 kB
- grails-app/conf/spring/resources.groovy 0.0 kB
- grails-app/.../AsyncController.groovy 0.4 kB
- grails-app/i18n/messages.properties 3 kB
- grails-app/.../messages_cs_CZ.properties 3 kB
- grails-app/i18n/messages_da.properties 3 kB
- grails-app/i18n/messages_de.properties 4 kB
- grails-app/i18n/messages_es.properties 3 kB
- grails-app/i18n/messages_fr.properties 2 kB
- grails-app/i18n/messages_it.properties 2 kB
- grails-app/i18n/messages_ja.properties 4 kB
- grails-app/i18n/messages_nl.properties 3 kB
- grails-app/.../messages_pt_BR.properties 3 kB
- grails-app/.../messages_pt_PT.properties 3 kB
- grails-app/i18n/messages_ru.properties 4 kB
- grails-app/i18n/messages_sv.properties 3 kB
- grails-app/i18n/messages_th.properties 5 kB
- grails-app/.../messages_zh_CN.properties 2 kB
- grails-app/views/async/searchAjax.gsp 0.0 kB
- grails-app/views/error.gsp 0.3 kB
- grails-app/views/index.gsp 3 kB
- grails-app/views/layouts/main.gsp 2 kB
- test/unit/.../AsyncControllerTests.groovy 0.3 kB
- application.properties 0.1 kB
Issue Links
- depends on
-
GRAILS-7981
Upgrade to Groovy 1.8.2
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
Any update on this? We are using Glassfish and Grails and this is a blocker for our project. I am working out by having two versions of build.config. With servlet 3.0 on remote build machine and 2.5 on local development machine. Ugly but works.
Andy - could you take a look at this. We have upgraded to Groovy 1.8.2 and the problem persists.
However, it seems that with the reloading agent deactivated the problem does not occur.
I'll attach an example app shortly.
Example that reproduces the issue. Follow these steps:
- start interactive mode with reloading enable by typing "grails"
- Within interactive mode type "run-app"
- Go to http://localhost:8080/asynctest/async/index in your browser
- You may need to fresh a few times but you'll get:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:420) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:851) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:756) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.
Follow the same steps with the reloading agent disabled (by starting interactive with "grails -noreloading")
And it is not possible to reproduce the OutOfMemoryError
Note Grails is now using Groovy 1.8.2 https://github.com/grails/grails-core/commit/306c687217e55425509a4ec7c34012b96de8f1ae
So it appears we can rule out http://jira.codehaus.org/browse/GROOVY-4673 as being the cause of the problem
I made some fixes in SpringLoaded early last week for another issue (permgen related), I also did some work related to general heap usage (non permgen). With all those fixes in (they are in the latest published 0.9.2 snapshot) I can't get this to fail with OutOfMemory. However, I can't comment on the switching of servlet versions.
This problem only occurs when the servlet version is changed to "3.0" I upgraded my project to Grails 2.0.0.M2 and "run-app" fails consistently. The server doesn't even start up.
The main issue here is that Deploying to Glassfish fails with servlet version set to "2.5"
The only work around I have currently is to debug on local machine with servlet version "2.5" and when I have to build a war to deploy to GF I change the version to "3.0".
I've done some testing with the 0.9.2 snapshots of spring loaded and can confirm that the permgen issues no longer occur with the servlet version set to 3.0
With the current release a new created app fails again with "java.lang.OutOfMemoryError: PermGen space", as soon as you change the servlet version to 3.0 and try "run-app".
I can also confirm this issue still exists. I can reliably reproduce the OOPM setting the servlet version to 3.0 with the following setup:
- Grails 2.0.0
- Groovy 1.8.4
- Java 1.6.0_30
For me this issue only arises, when starting from within Eclipse STS! When running from external console, its working. It might be an STS issue then.
I issue 'grails run-app' from the console and have this problem. I also do a clean and compile from the console before, so its probably not STS.
fixed by https://github.com/grails/grails-core/commit/31ca2b1faea4f7ec64c58d6bf3a852e92e3da3b5
You now have to explicitly enable Servlet 3.0 class path scanning and adjust your memory settings accordingly if you want those features of Servlet 3.0.
Since most users just want the Async support I don't think this is a big deal.
Note that this doesn't fix the problem for WAR deployments, and for that you will have to configure your container accordingly.
Inside Tomcat's conf/catalina.properties file there is a tomcat.util.scan.DefaultJarScanner.jarsToSkip setting that allows you to adjust the configuration to exclude the jars from scanning.
A workaround for 2.0.0 is to run:
grails install-templates
Then changes the src/templates/war/web.xml file and add the "metadata-complete" attribute:
<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" metadata-complete="true" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> ...
Yeah, we are seeing the same thing. Nasty one, means we can't deploy to Glassfish 3 until this is resolved.