Grails task fails in Bamboo build - OutOfMemoryError
Symptoms
Grails task fails when running a Bamboo build, and this error is in the build logs:
build 19-Aug-2013 14:51:45 | Packaging Grails application.....
build 19-Aug-2013 14:51:57 | Tests FAILED - view reports in /mnt/bamboo5/xml-data/build-dir/PROJ1-WEB-JOB1/target/test-reports
build 19-Aug-2013 14:51:58 | Error Error executing script TestApp: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'syncTriggerTrigger': ... Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler': Invocation of init method failed; nested exception is java.lang.OutOfMemoryError: unable to create new native thread (Use --stacktrace to see the full trace)
simple 19-Aug-2013 14:51:58 Failing task since return code of [/opt/grails/bin/grails test-app -non-interactive] was 1 while expected 0
...
Cause
Lack of memory for the Grails build or for the VM (if one is being used).
Resolution
Seeing OutOfMemoryError in the logs recommends increasing the heap for the Grails task. Please try to use this option (as it's mentioned here) in the Environment Variables field to increase the heap of the of the Grails task:
GRAILS_OPTS="-Xmx512M"
Alternatively, if you are running your build in a virtual environment, make sure that there is enough memory allocated to the VM.