fabriciorby/maven-surefire-junit5-tree-reporter

OOME when there are many tests failures

Opened this issue · 1 comments

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.

Hmmm, this is difficult for me to reproduce, the problem is probably in this part that you mentioned. I think it could be possible to prune the already executed tests information for a non parallel execution, for a parallel one I don't think it would be possible.

I'll flag it as a bug for now and get back later. (Hopefully less than 1 year)