java - Memory leak with PowerMock on Jenkins -
i think i'm getting memory leaks when using jenkins execute unit tests. if try execute more ~60 unit tests start tests failing java.lang.outofmemoryerror: permgen space
. often, not always, stack trace seems start in or near org.powermock.core.classloader.mockclassloader
, although it's not consistent. the maven surefire plugin configuration pretty straightforward:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.18</version> <executions> <execution> <phase>test</phase> <configuration> <reuseforks>false</reuseforks> <argline>-xx:permsize=512m -xx:maxpermsize=1024m</argline> </configuration> </execution> </executions> </plugin>
in jenkins, maven_opts set -xx:maxpermsize=1024m
.
i saw documents suggesting might related fact using older version of powermock, upgraded 1.6.0, still experiencing error.
i can't reproduce problem locally, seems happen on jenkins server.
i'm not sure how reliably resolve this: limiting number of tests cases execute seems work ok, have 150+ test cases execute , running batches of 50 tests @ time on server not seem solution. might able give bit more memory seems has enough, , don't think surefire needs memory when runs locally. there might way play around of other surefire settings, i'm not sure ones i'd need adjust, or how. has else every seen this, or have suggestion how resolve it?
this might relevant: development environment ibm's rad, , workspace launched option -xgcpolicy:gencon
, far can tell specific ibm's implementation of jvm. might reason unit tests run fine when run maven rad, not jenkins? if so, equivalent option standard (oracle) jvm, jenkins using?
the problem solved. never figured out memory leaks were, noticed in console, maven fork surefire never included arguments passed via <argline>
. when added same arguments maven command as:
mvn test -dargline="-xx:maxpermsize=1024m -xmx768m"
all tests executed fine, no outofmemory issues. think <argline>
element might not work correctly.
its -D not -d
ReplyDelete