Open cerny opened 11 years ago
Interesting. The issue I raised against Grails specifically requested that the forking be disabled when external build tools are used. I suspect that means the Grails Gradle plugin needs to be updated to fork the execution of its commands.
I got around this by creating a custom GrailsTask in my build.gradle file.
The default MaxPermSize was around 80m, so I increased it using the following:
task grailsRunApp(type: GrailsTask) { command "run-app" jvmOptions { jvmArgs (['-XX:PermSize=128m', '-XX:MaxPermSize=512m']) } }
Another option is to set the fork options for all GrailsTask
instances:
tasks.withType(org.grails.gradle.plugin.tasks.GrailsTask) { Task t ->
t.jvmOptions {
jvmArgs "-Xmx384mx", "-XX:MaxPermSize=256m"
}
}
It looks like Gradle uses the defaults of the JVM you're using if you don't set explicit options, although I'm not entirely sure on that point.
@pledbrook that's correct, it's up to the JVM.
I think the plugin should set some reasonable defaults for the forked VM, as long as those defaults can be overridden.
Not sure how to determine what these reasonable defaults would be.
The grails_opts from the grailsw script would probably be a reasonable default
On Fri, Nov 15, 2013 at 10:01 AM, Luke Daley notifications@github.comwrote:
Not sure how to determine what these reasonable defaults would be.
— Reply to this email directly or view it on GitHubhttps://github.com/grails/grails-gradle-plugin/issues/48#issuecomment-28589769 .
@pledbrook Are you going to add these defaults?
Not right now. I do need to go over the Gradle integration for Grails in Action again, so I might be able to take a look at it then. Not sure whether to do a tasks.withType()
configuration block or set the JVM options from the GrailsTask
constructor.
For completeness, this is what is in grailsw
:
if [ -n "$GRAILS_OPTS" ]
then
GRAILS_OPTS="$GRAILS_OPTS"
else
GRAILS_OPTS="-server -Xmx768M -Xms64M -XX:PermSize=32m -XX:MaxPermSize=256m -Dfile.encoding=U
fi
Forked execution of Tomcat server does not worked as expected.
In Grails 2.3.1, forking is enabled by default, but it seems that the grails-launcher plugin, which is used by the grails-gradle-plugin, does not create another process for Tomcat. This causes a PermGen, sometimes immediately at startup and other times while using the launched app.