Error running Compile on large Grails Project in Jenkins: GC Overhead Limit

grails, jenkins, windows

Solution

Well, I have a solution for those who stumble upon this problem.

JAVA_OPTS in windows seems to be a tricky beast to set and keep set, but using the EnvInject plugin in Jenkins, I was able to use the following: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Under the newly added 'Build Environment' step,

Check the box labeled 'Inject environment variables to the build process'

And add this to the 'Properties Content' textbox:

JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=256m

NO QUOTES ON THAT!

As I stated before, I had previously solved this by setting a system-wide JAVA_OPTS variable to windows (which was too much of a hack for our server's needs), so there are probably more than a few ways to get the job done here.

Hopefully this proves helpful to other frustrated Windows/Jenkins/Grails users!

Problem

I'm beginning to get to my wit's end on this one. I have Jenkins running inside a tomcat container on a Windows Server 2008 RC 2 box. We have a large Grails project here at work with a few dependent in-house plugins (something like 10 of them). Part of the process is to run ``` grails compile ``` On the project (Using the Grails plugin in jenkins, Grails version 1.3.7) The job starts just fine, but bombs out on this step with the following error: ``` [groovyc] Compiling 103 source files to D:\jenkins\jobs\my-build-job\workspace\my-application\target\classes Compilation error: java.lang.OutOfMemoryError: GC overhead limit exceeded ``` I have been unsuccessful in adding parameters to this particular build step in the "parameters" form field in the Grails plugin, as well as adding java parameters to the tomcat servlet container (the typically internet-recommended java opts for this GC overhead error). Here's a portion of the wrapper.conf of the servlet: ``` wrapper.java.additional.8=-Xmx2048m wrapper.java.additional.9=-Xss256k wrapper.java.additional.10=-Xms1024m wrapper.java.additional.11=-XX:+UseParallelGC wrapper.java.additional.12=-XX:-UseGCOverheadLimit wrapper.java.additional.13=-XX:MaxPermSize=256m ``` Does anyone have any ideas / suggestions?? I feel like I've tried everything to give this job enough memory (The box has 12 gigs of RAM, and I mean as you can see above I bumped the Heap Space up from something smaller like 256 and no PermGen adjustment to use 2gigs and 256M of PermGen! It shouldn't be complaining of resource constraints!) Please help!

Original source