Generally, "no" - we do not recover from memory leaks. The specific memory leak you're referring to here is actually one of the well-known jdk memory leaks. I've seen this solved in tomcat with 'tokenPollerProtection'. Surefire will have the same kind of leak if you're using forkmode=never; we don't have the kind of protection tomcat has (and probably don't need it!)
Any other forkmode should be immune from this problem, apart from what can leak inside the fork itself. Also remember to tweak memory settings with either MAVEN_OPTS or within the forked process by <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> Kristian 2013/5/3 laredotornado-3 <[email protected]> > Hi, > > I'm using Maven 3.0.3. Is it possible to configure Maven or the Surefire > plugin to recover from OutOfMemoryErrors? I notice with my JUnit tests, if > one test from file A fails with an "OutOfMemoryError," all subsequent tests > in my Maven Junit run (even those from different files) fail with > OutOfMemoryErrors. When I run the files in isolation (e.g. > "-Dtest=FileATest"), the test runs fine. > > I'm using the Surefire 2.14.1: > > <plugin> > <groupId>org.apache.maven.plugins</groupId> > > <artifactId>maven-surefire-plugin</artifactId> > <version>2.14.1</version> > </plugin> > > Thanks for any wisdom, - Dave > > > Here's an example of one of the OutOfMemoryErrors … > > Exception in thread "Poller SunPKCS11-Darwin" java.lang.OutOfMemoryError: > Java heap space > at sun.security.pkcs11.wrapper.PKCS11.C_GetSlotInfo(Native Method) > at sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:767) > at sun.security.pkcs11.SunPKCS11.access$100(SunPKCS11.java:42) > at > sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:700) > at java.lang.Thread.run(Thread.java:680) > > > > > > -- > View this message in context: > http://maven.40175.n5.nabble.com/Can-Maven-recover-from-OutOfMemoryErrors-during-JUnit-test-runs-tp5754845.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
