[ 
https://issues.apache.org/jira/browse/SUREFIRE-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17481407#comment-17481407
 ] 

Tibor Digana commented on SUREFIRE-1147:
----------------------------------------

[~NB4L1]
See my comment, 26 min ago, and the problem is that the OOM does not happen in 
the plugin JVM. Notice that `Utf8RecodingDeferredFileOutputStream` appears only 
in the plugin JVM. The OOM does not happen in plugin JVM. The OOM happens in 
the forked JVM and I can prove it by the stack trace. What it means? It means 
that substituting `Utf8RecodingDeferredFileOutputStream` won't help of course 
because the problem is in another JVM. It is in the JVM where the tests reside 
and it means that the problem is with the design of the tests itself.


{noformat}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on 
project parallel-stream: Execution default-test of goal 
org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: There was an 
error in the forked process
[ERROR] java.lang.OutOfMemoryError: Java heap space
[ERROR]         at java.util.Arrays.copyOf(Arrays.java:3332)
[ERROR]         at 
java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
[ERROR]         at 
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:448)
[ERROR]         at java.lang.StringBuffer.append(StringBuffer.java:270)
[ERROR]         at 
org.testng.reporters.TestHTMLReporter.generateTable(TestHTMLReporter.java:85)
[ERROR]         at 
org.testng.reporters.TestHTMLReporter.generateLog(TestHTMLReporter.java:312)
[ERROR]         at 
org.testng.reporters.TestHTMLReporter.onFinish(TestHTMLReporter.java:40)
[ERROR]         at org.testng.TestRunner.fireEvent(TestRunner.java:1244)
[ERROR]         at org.testng.TestRunner.afterRun(TestRunner.java:1035)
[ERROR]         at org.testng.TestRunner.run(TestRunner.java:621)
[ERROR]         at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
[ERROR]         at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
[ERROR]         at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
[ERROR]         at org.testng.SuiteRunner.run(SuiteRunner.java:254)
[ERROR]         at 
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
[ERROR]         at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
[ERROR]         at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
[ERROR]         at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
[ERROR]         at org.testng.TestNG.run(TestNG.java:1057)
[ERROR]         at 
org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
[ERROR]         at 
org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:129)
[ERROR]         at 
org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:113)
[ERROR]         at 
org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111)
[ERROR]         at 
org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
[ERROR]         at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
[ERROR]         at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
{noformat}


> Unbounded memory usage when running MANY tests
> ----------------------------------------------
>
>                 Key: SUREFIRE-1147
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1147
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.18.1
>         Environment: win7, jdk 8u25, mvn 3.2.5
>            Reporter: Laurent Claisse
>            Assignee: Tibor Digana
>            Priority: Major
>             Fix For: Backlog
>
>         Attachments: surefire-allocation-traces.png, surefire-leak.png, 
> surefire-leak2.png, surefire-leak3.png
>
>
> I'm writing concurrency tests, checking that this thing is reproducible, that 
> other thing isn't, and so on. So i repeat tests MANY times like 100_000 (to 
> reproduce the leak, the test project is here: 
> https://github.com/vandekeiser/parallel-stream-fork-join-pool)
> I see in VisualVM that the culprit is WrappedReportEntry, which indirectly 
> holds references to lots of byte[] and char[] (allocation traces and heap 
> dump pics are included in attachment)
> I forked and patched maven-surefire-common, and that makes the leak go. I had 
> to replace WrappedReportEntry.original by a singleton fake ReportEntry. 
> Bebefore that i had replaced 
> Utf8RecodingDeferredFileOutputStream.deferredFileOutputStream by a 
> NullOutputStream and the leak was lesser but still here.
> My fork of maven-surefire-common is there: 
> https://github.com/vandekeiser/maven-surefire/tree/master/maven-surefire-common.
> It IS a patch so i checked the patch checkbox in the issue reporter, but it 
> is NOT intended to be distributed of course since it is very brutal and basic.
> Also in my test project i explicitly deactivated reporting, but that doesn't 
> make the reporting leak go away at all:
> <disableXmlReport>true</disableXmlReport>
> <printSummary>false</printSummary>



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to