JDK-8342775 : [Graal] java/util/concurrent/locks/Lock/OOMEInAQS.java fails OOME thrown from the UncaughtExceptionHandler
Type:Bug
Component:hotspot
Sub-Component:compiler
Affected Version:24
Priority:P4
Status:Open
Resolution:Unresolved
Submitted:2024-10-22
Updated:2024-10-28
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.
Test
java/util/concurrent/locks/Lock/OOMEInAQS.java fails OOME thrown from the UncaughtExceptionHandler
during PIT for JEP 491: Synchronize Virtual Threads without Pinning
Test always fails with Graal only.
Comments
A pull request was submitted for review.
Branch: master
URL: https://git.openjdk.org/jdk/pull/21745
Date: 2024-10-28 18:45:59 +0000
28-10-2024
This seems to the generic problem with rematerialization of scalar replaced objects failing during deopt like JDK-8227309. In this case it's the threads array allocated in main and the deopt is for an unresolved field down in the call to CountDownLatch.countDown at AQS.signalNext
public static void main(String[] args) throws Throwable {
OOMEInAQS[] threads = new OOMEInAQS[NTHREADS];
for (int i = 0; i < NTHREADS; ++i)
(threads[i] = new OOMEInAQS(i)).start();
started.countDown();
canFill.await();
long t0 = System.nanoTime();
data = fillHeap();
filled.countDown();
so this failure doesn't have any implications for the correctness of the test itself but for whatever reason it fails in a stable fashion with the loom bits. I think changing NTHREADS to be non-final would keep graal from scalar replacing the array which would avoid the problem.
23-10-2024
I could reproduce locally on my Linux box:
> env JVMCI_VERSION_CHECK=ignore mx -y -p graal-enterprise/graal-enterprise fetch-jdk oraclejdk-latest "24 build_id=2024-10-17-2147406.yudi.zheng.jdk" --to build --alias yudi_jdk
> make test-only CONF_CHECK=ignore JDK_UNDER_TEST=$PWD/build/yudi_jdk CONF_NAME=linux-x64-debug TEST_VM_OPTS="-Xcomp -ea -esa -XX:CompileThreshold=100 -XX:+UnlockExperimentalVMOptions -server -XX:-TieredCompilation -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler -Xlog:exceptions" 'JTREG_EXTRA_PROBLEM_LISTS=../../../../closed/test/ProblemList-galahad-ee.txt ../../../closed/test/ProblemList-galahad-ee.txt ProblemList-Xcomp.txt' JTREG_TIMEOUT_FACTOR=25 TEST=java/util/concurrent/locks/Lock/OOMEInAQS.java
In OOMEInAQS.jtr, I see:
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in JVMCI compiled method <{method} {0x00007b540a40c280} 'invokeStatic' '(Ljava/lang/Object;Ljava/lang/Object;)V' in 'java/lang/invoke/LambdaForm$DMH+0x00007b540a40c3a8'>
at PC0x00007b548078c280 for thread 0x00007b547c168fc0
[4.151s][info][exceptions] Thread 0x00007b547c168fc0 continuing at PC 0x00007b548035534c for exception thrown at PC 0x00007b548078c280
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in interpreter method <{method} {0x00007b540a40c280} 'invokeStatic' '(Ljava/lang/Object;Ljava/lang/Object;)V' in 'java/lang/invoke/LambdaForm$DMH+0x00007b540a40c3a8'>
at bci 10 for thread 0x00007b547c168fc0 (MainThread)
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in interpreter method <{method} {0x00007b540a4112b0} 'invoke' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' in 'java/lang/invoke/LambdaForm$MH+0x00007b540a4113d8'>
at bci 33 for thread 0x00007b547c168fc0 (MainThread)
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in JVMCI compiled method <{method} {0x00007b540e20eb08} 'invokeExact_MT' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' in 'java/lang/invoke/Invokers$Holder'>
at PC0x00007b54807ac6e4 for thread 0x00007b547c168fc0
[4.151s][info][exceptions] Thread 0x00007b547c168fc0 continuing at PC 0x00007b548035534c for exception thrown at PC 0x00007b54807ac6e4
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in interpreter method <{method} {0x00007b540e20eb08} 'invokeExact_MT' '(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' in 'java/lang/invoke/Invokers$Holder'>
at bci 20 for thread 0x00007b547c168fc0 (MainThread)
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in interpreter method <{method} {0x00007b540e468aa8} 'invokeImpl' '(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;' in 'jdk/internal/reflect/DirectMethodHandleAccessor'>
at bci 55 for thread 0x00007b547c168fc0 (MainThread)
[4.151s][info][exceptions] Exception <a 'java/lang/OutOfMemoryError'{0x00007b5470b86fe0}: Java heap space: failed reallocation of scalar replaced objects>
thrown in interpreter method <{method} {0x00007b540e2bc8a8} 'invoke' '(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;' in 'jdk/internal/reflect/DirectMethodHandleAccessor'>
at bci 23 for thread 0x00007b547c168fc0 (MainThread)
22-10-2024
The log:
command: main -XX:+UseG1GC -XX:-UseGCOverheadLimit -Xmx48M -XX:-UseTLAB OOMEInAQS
reason: User specified action: run main/othervm -XX:+UseG1GC -XX:-UseGCOverheadLimit -Xmx48M -XX:-UseTLAB OOMEInAQS
started: Sun Oct 20 09:43:09 UTC 2024
Mode: othervm [/othervm specified]
finished: Sun Oct 20 09:43:46 UTC 2024
elapsed time (seconds): 36.563
----------configuration:(0/0)----------
----------System.out:(0/0)----------
----------System.err:(4/200)----------
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "MainThread"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"