Closed
Description
Describe the issue
When running the following test using Graal, Graal crashed with a segmentation fault.
import java.lang.ref.WeakReference;
import java.math.MathContext;
class T {
int f() {
int q = 43837, p;
MathContext u = null;
for (int w = 648; w < 9230; w += 1)
try {
p = u.getPrecision();
} catch (Throwable x) {
} finally {
}
WeakReference r = null;
try {
while (r.get() != null) {}
} catch (Throwable x) {
} finally {
}
return (int) (long) q;
}
public static void main(String[] g) {
T t = new T();
for (; ; ) t.f();
}
}
Steps to reproduce the issue
- javac T.java
- java -XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions -XX:-BackgroundCompilation -XX:-PrintCompilation --illegal-access=deny T
Describe GraalVM and your environment:
- GraalVM version: GraalVM CE 23.1.0-dev-20230328_0529
- JDK major version: 17
- OS: Ubuntu 20.04.5 LTS
- Architecture: AMD64
More details
From the log, it looks liky the crash occurs because of C1 (and OSR): J 41% c1 T.f()I
. However, there isn't any crash observed if we directly run the test in HotSpot. The following is part of the crash:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f28e6da077c, pid=162531, tid=162532
#
# JRE version: OpenJDK Runtime Environment GraalVM CE 23.1.0-dev (17.0.7+4) (build 17.0.7+4-jvmci-23.0-b09)
# Java VM: OpenJDK 64-Bit Server VM GraalVM CE 23.1.0-dev (17.0.7+4-jvmci-23.0-b09, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# J 41% c1 T.f()I (73 bytes) @ 0x00007f28e6da077c [0x00007f28e6da06c0+0x00000000000000bc]
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/simon/Desktop/test-jitcomp/ax-eval/bugs2/19.graal/mutant/red/ttt/core.162531)
#
# If you would like to submit a bug report, please visit:
# https://github.com/oracle/graal/issues
#
--------------- S U M M A R Y ------------
Command Line: -XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions -XX:-BackgroundCompilation -XX:-PrintCompilation --illegal-access=deny T
Host: Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz, 8 cores, 31G, Ubuntu 20.04.5 LTS
Time: Mon Apr 3 19:35:06 2023 CST elapsed time: 0.698355 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x00007f28f8025920): JavaThread "main" [_thread_in_Java, id=162532, stack(0x00007f28fc2d0000,0x00007f28fc3d1000)]
Stack: [0x00007f28fc2d0000,0x00007f28fc3d1000], sp=0x00007f28fc3cf950, free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 41% c1 T.f()I (73 bytes) @ 0x00007f28e6da077c [0x00007f28e6da06c0+0x00000000000000bc]
j T.main([Ljava/lang/String;)V+9
v ~StubRoutines::call_stub
V [libjvm.so+0x7fc1e5] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x315
V [libjvm.so+0x8972cd] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, JavaThread*) [clone .constprop.1]+0x38d
V [libjvm.so+0x89a10e] jni_CallStaticVoidMethod+0x16e
C [libjli.so+0x46ae] JavaMain+0xcfe
C [libjli.so+0x7d39] ThreadJavaMain+0x9
See more in hs_err_pid162531.log.