JDK-8166046 : [TESTBUG] compiler/stringopts/TestStringObjectInitialization.java fails with OOME
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7u121,8u92,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-09-14
  • Updated: 2021-04-27
  • Resolved: 2016-09-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9 Other
9 b140Fixed openjdk8u302Fixed
Related Reports
Relates :  
Description
This failure happens once in PIT on Windows-x86
VM options : -Xcomp -XX:MaxRAMFraction=8 -XX:+CreateCoredumpOnCrash -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot

#section:main
----------messages:(4/464)----------
command: main -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-CompactStrings -XX:-UseG1GC -XX:+UseParallelGC compiler.stringopts.TestStringObjectInitialization
reason: User specified action: run main/othervm/timeout=300 -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-CompactStrings -XX:-UseG1GC -XX:+UseParallelGC compiler.stringopts.TestStringObjectInitialization 
Mode: othervm [/othervm specified]
elapsed time (seconds): 336.474
----------configuration:(0/0)----------
----------System.out:(0/0)----------
----------System.err:(16/1357)----------
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(java.base@9-internal/Arrays.java:3744)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(java.base@9-internal/AbstractStringBuilder.java:146)
	at java.lang.AbstractStringBuilder.append(java.base@9-internal/AbstractStringBuilder.java:510)
	at java.lang.StringBuilder.append(java.base@9-internal/StringBuilder.java:141)
	at compiler.stringopts.TestStringObjectInitialization.add(TestStringObjectInitialization.java:62)
	at compiler.stringopts.TestStringObjectInitialization.run(TestStringObjectInitialization.java:67)
	at compiler.stringopts.TestStringObjectInitialization$Runner.run(TestStringObjectInitialization.java:80)
	at java.lang.Thread.run(java.base@9-internal/Thread.java:843)
java.lang.OutOfMemoryError: Java heap space
	at compiler.stringopts.TestStringObjectInitialization.add(TestStringObjectInitialization.java:62)
	at compiler.stringopts.TestStringObjectInitialization.run(TestStringObjectInitialization.java:67)
	at compiler.stringopts.TestStringObjectInitialization$Runner.run(TestStringObjectInitialization.java:80)
	at java.lang.Thread.run(java.base@9-internal/Thread.java:843)
Comments
Fix Request (8u) This stabilizes the test in 8u. Patch does not apply cleanly to 8u and needs minor adaptations. 8u RFR (acked by zgu): https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-April/013673.html
21-04-2021

Updated fix: http://cr.openjdk.java.net/~thartmann/8166046/webrev.01
20-09-2016

ILW = testbug, on 32-bit platforms, no workaround = MLH = P4
19-09-2016

The test creates 101 threads that each execute a loop with 10.000 iterations that append to a String another String of size 17. This results in a String of size 101 * 10.000 * 17 = 17.170.000 ( = 35 MB). In the failing cases, the test is executed on 32-bit Windows with -Xcomp and -XX:+DeoptimizeALot which increase memory consumption of the VM due to extensive (re-)compilation, deoptimization and re-allocation. The test fails because there is not enough heap space to hold the String. Proposed fix: http://cr.openjdk.java.net/~thartmann/8166046/webrev.00/
19-09-2016