maven-surefire-junit5-tree-reporter
maven-surefire-junit5-tree-reporter copied to clipboard
OOME when there are many tests failures
We have a project with 700+ tests and on our CI we noticed multiple times OOME errors (sadly we weren't able to get a dump) when our tests are failing.
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "surefire-forkedjvm-command-thread"
failsafe / surefire are configured with
<!-- Custom reports -->
<reportFormat>plain</reportFormat>
<consoleOutputReporter>
<disable>true</disable>
</consoleOutputReporter>
<statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter"/>
and JUnit with
junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=same_thread
junit.jupiter.execution.parallel.mode.classes.default=concurrent
To display the tests results as tree I suppose the reporting is keeping in memory many informations due to the execution of tests in parallel (I see several statics fileds in https://github.com/fabriciorby/maven-surefire-junit5-tree-reporter/blob/master/src/main/java/org/apache/maven/plugin/surefire/report/TestReportHandler.java#L12-L15)
If there are several failures and the memory is limited like in a CI system a surefire JVM can die with an OOME because of the TestReportHandler size. We could probably increase the tests JVMs size but it's a bit annoying to do it just for the tests reporter.