Travis Maven build exits with OutOfMemoryException
I have a maven build running on Travis (dockerized) which builds just fine on my command line. Since a couple of days I get java.lang.OutOfMemoryError: GC overhead limit exceeded during the test cases. This happens always during the AspectJ test cases.
The output of the last build is https://travis-ci.org/dresden-ocl/dresdenocl/builds/53030457.
I did not made any intensive changes. And I did not touch the AspectJ part of the application. I tested various things with JAVA_OPTS, MAVEN_OPTS and even passing more RAM in the pom.xml for tycho-surefire-plugin. Nothing helped.
How can I get rid of the error and make all my tests run again? I think they changed anything on Travis' side that is causing the error.
GC overhead limit exceeded means that your JVM is spending the most of the time in garbage collection which indicates some serious problems. This could not be fixed through JAVA_OPTS or MAVEN_OPTS because this is a programming (code) problem. You can try to add
Try increasing your stack size, e.g. by ulimit -s 82768 and re-try. To check the limits, run ulimit -a or free -m for free memory.
The solution is stated here and references an issue how Travis CI provides MAVEN_OPTS. So if you are not fine with provided MAVEN_OPTS values you are not able to build in an containerized environment, because there is no sudo available.
before_install: - sudo rm /etc/mavenrc - export M2_HOME=/usr/local/maven - export MAVEN_OPTS="-Dmaven.repo.local=$HOME/.m2/repository -Xms1024m -Xmx3072m -XX:PermSize=512m"
This pull request will make your changes to MAVEN_OPTS work. Thus, you can change MAVEN_OPTS without having to use the workaround above and therefore can use containerized builds with Maven.