JDK-8289764 : gc/lock tests failed with "OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 19,20
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2022-07-05
  • Updated: 2024-10-23
  • Resolved: 2022-08-25
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 11 JDK 17 JDK 20 JDK 8
11.0.23-oracleFixed 17.0.11-oracleFixed 20 b12Fixed 8u421Fixed
Related Reports
Relates :  
Relates :  
Description
The following test failed in the JDK20 CI:

vmTestbase/gc/lock/jniref/jnilocalreflock02/TestDescription.java

Here's a snippet from the log file:

Starting Thread[#81,gc.lock.LockerTest$Worker@40e5fd76,5,MainThreadGroup]
Starting Thread[#82,gc.lock.LockerTest$Worker@1ca29e16,5,MainThreadGroup]
Exception in 
gc.lock.LockerTest$Worker@794fed6b
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
Exception in 
Exception in 
gc.lock.LockerTest$Worker@f7107ea
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
Exception in 
Exception in 
Exception in 
Exception in 
gc.lock.LockerTest$Worker@4096fc72
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
gc.lock.LockerTest$Worker@7e2fceaf
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
Exception in 
Exception in 
Exception in 
Exception in 
Exception in 
gc.lock.LockerTest$Worker@3164868f
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
Exception in 
Exception in 
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
gc.lock.LockerTest$Worker@5580a850
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
gc.lock.LockerTest$Worker@f8f46ab
java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
----------System.err:(2/128)----------
java.lang.OutOfMemoryError: Java heap space
STATUS:Failed.`main' threw exception: java.lang.OutOfMemoryError: Java heap space
----------rerun:(41/6353)*----------
Comments
[jdk11u-fix-request] Approval Request from Amos “Backporting for parity with jdk 11.0.23-oracle. No risk, test fix. Un-Clean backport. SAP nightlies passed on 2024-01-25,26”
28-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/2469 Date: 2024-01-22 10:49:12 +0000
22-01-2024

Fix request [17u] I backport this for parity with 17.0.11-oracle. No risk, only a test change. Clean backport. Tests pass. SAP nightly testing passed.
30-11-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/1993 Date: 2023-11-29 14:14:04 +0000
29-11-2023

Changeset: 7b81a9c7 Author: Ramkumar Sunderbabu <rsunderbabu@openjdk.org> Committer: Leonid Mesnik <lmesnik@openjdk.org> Date: 2022-08-25 01:37:54 +0000 URL: https://git.openjdk.org/jdk/commit/7b81a9c75d60f6eb2727515bacfffcf7cf15e128
25-08-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9658 Date: 2022-07-27 14:03:34 +0000
27-07-2022

All gc/lock/ tests are more or less the same and most are not even related to GC locker. They verify that GC is appropriately synchronized with certain class of functions. gc/lock/jni - uses JNI GetPrimitiveArrayCritical and GetStringCritical gc/lock/jniref - uses JNI NewGlobalRef, NewLocalRef, NewWeakGlobalRef gc/lock/malloc - uses malloc() gc/lock/jvmti - uses JVMTI Allocate There is already vmTestbase/nsk/stress/jni/gclocker/gcl001.java testing JNI's GetPrimitiveArrayCritical, the only call that is related to GC locker. Dropping these tests looks reasonable. We might still choose to retain the tests to check GC's interaction with native memory access, in which case, one test is enough against a class of function.
23-07-2022

So far this failure mode has been seen in 13 different tests in the JDK19 and JDK20 CIs. With a single sighting per test: $ sort /tmp/8289764.list | uniq -c 1 vmTestbase/gc/lock/jni/jnilock003/TestDescription.java 1 vmTestbase/gc/lock/jniref/jniglobalreflock01/TestDescription.java 1 vmTestbase/gc/lock/jniref/jniglobalreflock04/TestDescription.java 1 vmTestbase/gc/lock/jniref/jnilocalreflock02/TestDescription.java 1 vmTestbase/gc/lock/jniref/jnilocalreflock03/TestDescription.java 1 vmTestbase/gc/lock/jniref/jnilocalreflock04/TestDescription.java 1 vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java 1 vmTestbase/gc/lock/jniref/jnireflock02/TestDescription.java 1 vmTestbase/gc/lock/jniref/jnireflock03/TestDescription.java 1 vmTestbase/gc/lock/jniref/jniweakglobalreflock01/TestDescription.java 1 vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TestDescription.java 1 vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TestDescription.java 1 vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TestDescription.java So the individual sightings don't meet our normal criteria for ProblemListing, but the total count of sightings for this bug (JDK-8289764) are definitely noisy. This is a frustrating situation.
22-07-2022

[~lkorinth] - As mentioned above, I intentionally did not use: JDK-8289206 vmTestbase/gc/lock tests fail with OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects because that bug is focused on the JDK11u sighting and [~kbarrett]'s analysis of that bug is focused on it being related to specific bugs that are already fixed. This bug is focused on sightings in JDK20. Update: And now JDK19 also.
07-07-2022