Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8259745 | 17 | Calvin Cheung | P3 | Resolved | Fixed | b06 |
JDK-8260133 | 16.0.1 | Calvin Cheung | P3 | Resolved | Fixed | b03 |
As reported in https://github.com/jruby/jruby/pull/6109#issuecomment-749749092
<quote>
The commit in f28245b seems to be causing an early access Java 16 to crash with the following output, after generating the CDS archive using the generate_appcds command in the jruby-startup gem:
https://gist.github.com/headius/60ecfc3e120e10e8a3e1f801539520e6
If I comment out the gathering of options into ALL_OPTIONS and hardcode the lazy_rubygems check to true it no longer crashes, but it works fine without CDS or with CDS on Java 15.
</quote>
It seems to be related to the handling of archived Lambda proxy classes in the CDS archive. Here's the abbreviated stack leading up to the crash:
V LinkResolver::resolve_invokedynamic +0x80
V InterpreterRuntime::resolve_invokedynamic
V InterpreterRuntime::resolve_from_cache
j org.jruby.util.cli.Options.<clinit> +3665
j org.jruby.util.log.LoggerFactory.<clinit>
j org.jruby.Main.<clinit>
V InstanceKlass::call_class_initializer
V jni_GetStaticMethodID
C JavaMain
============= More details below, and in attached hs_err.txt
[] ~/projects/jruby $ time ruby --dev -e 1
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000001025bf33d, pid=94810, tid=7427
#
# JRE version: OpenJDK Runtime Environment (16.0+29) (build 16-ea+29-2091)
# Java VM: OpenJDK 64-Bit Server VM (16-ea+29-2091, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# V [libjvm.dylib+0x9bf33d] SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x1d
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/headius/projects/jruby/hs_err_pid94810.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
Abort trap: 6
real 0m0.262s
user 0m0.217s
sys 0m0.075s
[] ~/projects/jruby $ cat hs_err_pid94810.log
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000001025bf33d, pid=94810, tid=7427
#
# JRE version: OpenJDK Runtime Environment (16.0+29) (build 16-ea+29-2091)
# Java VM: OpenJDK 64-Bit Server VM (16-ea+29-2091, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# V [libjvm.dylib+0x9bf33d] SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x1d
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-PrintWarnings -Djruby.compile.mode=OFF -Djruby.compile.invokedynamic=false -Djnr.ffi.asm.enabled=false -Xverify:none --add-opens=java.base/java.io=org.jruby.dist --add-opens=java.base/java.nio.channels=org.jruby.dist --add-opens=java.base/sun.nio.ch=org.jruby.dist --add-opens=java.management/sun.management=org.jruby.dist -Xss2048k -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=/Users/headius/projects/jruby/lib/jruby.jsa -Djffi.boot.library.path=/Users/headius/projects/jruby/lib/jni -Djava.security.egd=file:/dev/urandom --module-path=/Users/headius/projects/jruby/lib/jruby.jar -Djruby.home=/Users/headius/projects/jruby -Djruby.lib=/Users/headius/projects/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main -e 1
Host: MacBookPro13,3 x86_64 2900 MHz, 8 cores, 16G, Darwin 18.7.0, macOS 10.14.6 (18G4032)
Time: Tue Dec 22 13:17:57 2020 CST elapsed time: 0.155430 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x00007ff93e000800): JavaThread "main" [_thread_in_vm, id=7427, stack(0x00007000043dd000,0x00007000045dd000)]
Stack: [0x00007000043dd000,0x00007000045dd000], sp=0x00007000045db210, free space=2040k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x9bf33d] SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x1d
V [libjvm.dylib+0x3dec3a] Exceptions::new_exception(Thread*, Symbol*, Symbol*, JavaCallArguments*, Handle, Handle)+0x2a
V [libjvm.dylib+0x3df078] Exceptions::new_exception(Thread*, Symbol*, Symbol*, JavaCallArguments*, Handle, Handle, Handle)+0x38
V [libjvm.dylib+0x3de6e6] Exceptions::new_exception(Thread*, Symbol*, char const*, Handle, Handle, Handle, Exceptions::ExceptionMsgToUtf8Mode)+0x106
V [libjvm.dylib+0x3de59b] Exceptions::_throw_msg(Thread*, char const*, int, Symbol*, char const*, Handle, Handle)+0xab
V [libjvm.dylib+0x3ded08] Exceptions::_throw_msg(Thread*, char const*, int, Symbol*, char const*)+0x18
V [libjvm.dylib+0x340d09] ConstantPool::throw_resolution_error(constantPoolHandle const&, int, Thread*)+0xc9
V [libjvm.dylib+0x341c21] ConstantPool::resolve_constant_at_impl(constantPoolHandle const&, int, int, bool*, Thread*)+0x211
V [libjvm.dylib+0x3427da] ConstantPool::copy_bootstrap_arguments_at_impl(constantPoolHandle const&, int, int, int, objArrayHandle, int, bool, Handle, Thread*)+0x19a
V [libjvm.dylib+0x1c3914] BootstrapInfo::resolve_args(Thread*)+0x424
V [libjvm.dylib+0x1c344f] BootstrapInfo::resolve_bsm(Thread*)+0x26f
V [libjvm.dylib+0x9c6b8d] SystemDictionary::invoke_bootstrap_method(BootstrapInfo&, Thread*)+0x2d
V [libjvm.dylib+0x72787e] LinkResolver::resolve_dynamic_call(CallInfo&, BootstrapInfo&, Thread*)+0x1e
V [libjvm.dylib+0x727280] LinkResolver::resolve_invokedynamic(CallInfo&, constantPoolHandle const&, int, Thread*)+0x80
V [libjvm.dylib+0x502f44] InterpreterRuntime::resolve_invokedynamic(JavaThread*)+0x174
V [libjvm.dylib+0x5030d0] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x120
j org.jruby.util.cli.Options.<clinit>()V+3665 org.jruby.dist
v ~StubRoutines::call_stub
V [libjvm.dylib+0x5098e2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2d2
V [libjvm.dylib+0x4e7f14] InstanceKlass::call_class_initializer(Thread*)+0x254
V [libjvm.dylib+0x4e7591] InstanceKlass::initialize_impl(Thread*)+0x5b1
V [libjvm.dylib+0x724630] LinkResolver::resolve_field(fieldDescriptor&, LinkInfo const&, Bytecodes::Code, bool, Thread*)+0x5b0
V [libjvm.dylib+0x724060] LinkResolver::resolve_field_access(fieldDescriptor&, constantPoolHandle const&, int, methodHandle const&, Bytecodes::Code, Thread*)+0x40
V [libjvm.dylib+0x501c05] InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)+0x1c5
V [libjvm.dylib+0x502feb] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x3b
j org.jruby.util.log.LoggerFactory.<clinit>()V+0 org.jruby.dist
v ~StubRoutines::call_stub
V [libjvm.dylib+0x5098e2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2d2
V [libjvm.dylib+0x4e7f14] InstanceKlass::call_class_initializer(Thread*)+0x254
V [libjvm.dylib+0x4e7591] InstanceKlass::initialize_impl(Thread*)+0x5b1
V [libjvm.dylib+0x7248a3] LinkResolver::resolve_static_call(CallInfo&, LinkInfo const&, bool, Thread*)+0x73
V [libjvm.dylib+0x726dd0] LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, Thread*)+0x80
V [libjvm.dylib+0x502922] InterpreterRuntime::resolve_invoke(JavaThread*, Bytecodes::Code)+0x342
V [libjvm.dylib+0x503006] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x56
j org.jruby.Main.<clinit>()V+2 org.jruby.dist
v ~StubRoutines::call_stub
V [libjvm.dylib+0x5098e2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2d2
V [libjvm.dylib+0x4e7f14] InstanceKlass::call_class_initializer(Thread*)+0x254
V [libjvm.dylib+0x4e7591] InstanceKlass::initialize_impl(Thread*)+0x5b1
V [libjvm.dylib+0x567121] get_method_id(JNIEnv_*, _jclass*, char const*, char const*, bool, Thread*)+0x191
V [libjvm.dylib+0x5674b8] jni_GetStaticMethodID+0xd8
C [libjli.dylib+0x4e6b] JavaMain+0xbcb
C [libjli.dylib+0x7519] ThreadJavaMain+0x9
C [libsystem_pthread.dylib+0x32eb] _pthread_body+0x7e
C [libsystem_pthread.dylib+0x6249] _pthread_start+0x42
C [libsystem_pthread.dylib+0x240d] thread_start+0xd
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.jruby.util.cli.Options.<clinit>()V+3665 org.jruby.dist
v ~StubRoutines::call_stub
j org.jruby.util.log.LoggerFactory.<clinit>()V+0 org.jruby.dist
v ~StubRoutines::call_stub
j org.jruby.Main.<clinit>()V+2 org.jruby.dist
v ~StubRoutines::call_stub
siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000004
Register to memory mapping:
RAX=0x0 is NULL
RBX=0x0 is NULL
RCX=0x0000000000000001 is an unknown value
RDX=0x0 is NULL
RSP=0x00007000045db210 is pointing into the stack for thread: 0x00007ff93e000800
RBP=0x00007000045db240 is pointing into the stack for thread: 0x00007ff93e000800
RSI=0x0 is NULL
RDI=0x0 is NULL
R8 =0x00007ff93e000800 is a thread
R9 =0x0 is NULL
R10=0x00007ff93dd0b530 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
R11=0x0 is NULL
R12=0x0 is NULL
R13=0x0 is NULL
R14=0x0000000000000001 is an unknown value
<quote>
The commit in f28245b seems to be causing an early access Java 16 to crash with the following output, after generating the CDS archive using the generate_appcds command in the jruby-startup gem:
https://gist.github.com/headius/60ecfc3e120e10e8a3e1f801539520e6
If I comment out the gathering of options into ALL_OPTIONS and hardcode the lazy_rubygems check to true it no longer crashes, but it works fine without CDS or with CDS on Java 15.
</quote>
It seems to be related to the handling of archived Lambda proxy classes in the CDS archive. Here's the abbreviated stack leading up to the crash:
V LinkResolver::resolve_invokedynamic +0x80
V InterpreterRuntime::resolve_invokedynamic
V InterpreterRuntime::resolve_from_cache
j org.jruby.util.cli.Options.<clinit> +3665
j org.jruby.util.log.LoggerFactory.<clinit>
j org.jruby.Main.<clinit>
V InstanceKlass::call_class_initializer
V jni_GetStaticMethodID
C JavaMain
============= More details below, and in attached hs_err.txt
[] ~/projects/jruby $ time ruby --dev -e 1
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000001025bf33d, pid=94810, tid=7427
#
# JRE version: OpenJDK Runtime Environment (16.0+29) (build 16-ea+29-2091)
# Java VM: OpenJDK 64-Bit Server VM (16-ea+29-2091, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# V [libjvm.dylib+0x9bf33d] SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x1d
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/headius/projects/jruby/hs_err_pid94810.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
Abort trap: 6
real 0m0.262s
user 0m0.217s
sys 0m0.075s
[] ~/projects/jruby $ cat hs_err_pid94810.log
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000001025bf33d, pid=94810, tid=7427
#
# JRE version: OpenJDK Runtime Environment (16.0+29) (build 16-ea+29-2091)
# Java VM: OpenJDK 64-Bit Server VM (16-ea+29-2091, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# V [libjvm.dylib+0x9bf33d] SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x1d
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:-PrintWarnings -Djruby.compile.mode=OFF -Djruby.compile.invokedynamic=false -Djnr.ffi.asm.enabled=false -Xverify:none --add-opens=java.base/java.io=org.jruby.dist --add-opens=java.base/java.nio.channels=org.jruby.dist --add-opens=java.base/sun.nio.ch=org.jruby.dist --add-opens=java.management/sun.management=org.jruby.dist -Xss2048k -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=/Users/headius/projects/jruby/lib/jruby.jsa -Djffi.boot.library.path=/Users/headius/projects/jruby/lib/jni -Djava.security.egd=file:/dev/urandom --module-path=/Users/headius/projects/jruby/lib/jruby.jar -Djruby.home=/Users/headius/projects/jruby -Djruby.lib=/Users/headius/projects/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main -e 1
Host: MacBookPro13,3 x86_64 2900 MHz, 8 cores, 16G, Darwin 18.7.0, macOS 10.14.6 (18G4032)
Time: Tue Dec 22 13:17:57 2020 CST elapsed time: 0.155430 seconds (0d 0h 0m 0s)
--------------- T H R E A D ---------------
Current thread (0x00007ff93e000800): JavaThread "main" [_thread_in_vm, id=7427, stack(0x00007000043dd000,0x00007000045dd000)]
Stack: [0x00007000043dd000,0x00007000045dd000], sp=0x00007000045db210, free space=2040k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x9bf33d] SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x1d
V [libjvm.dylib+0x3dec3a] Exceptions::new_exception(Thread*, Symbol*, Symbol*, JavaCallArguments*, Handle, Handle)+0x2a
V [libjvm.dylib+0x3df078] Exceptions::new_exception(Thread*, Symbol*, Symbol*, JavaCallArguments*, Handle, Handle, Handle)+0x38
V [libjvm.dylib+0x3de6e6] Exceptions::new_exception(Thread*, Symbol*, char const*, Handle, Handle, Handle, Exceptions::ExceptionMsgToUtf8Mode)+0x106
V [libjvm.dylib+0x3de59b] Exceptions::_throw_msg(Thread*, char const*, int, Symbol*, char const*, Handle, Handle)+0xab
V [libjvm.dylib+0x3ded08] Exceptions::_throw_msg(Thread*, char const*, int, Symbol*, char const*)+0x18
V [libjvm.dylib+0x340d09] ConstantPool::throw_resolution_error(constantPoolHandle const&, int, Thread*)+0xc9
V [libjvm.dylib+0x341c21] ConstantPool::resolve_constant_at_impl(constantPoolHandle const&, int, int, bool*, Thread*)+0x211
V [libjvm.dylib+0x3427da] ConstantPool::copy_bootstrap_arguments_at_impl(constantPoolHandle const&, int, int, int, objArrayHandle, int, bool, Handle, Thread*)+0x19a
V [libjvm.dylib+0x1c3914] BootstrapInfo::resolve_args(Thread*)+0x424
V [libjvm.dylib+0x1c344f] BootstrapInfo::resolve_bsm(Thread*)+0x26f
V [libjvm.dylib+0x9c6b8d] SystemDictionary::invoke_bootstrap_method(BootstrapInfo&, Thread*)+0x2d
V [libjvm.dylib+0x72787e] LinkResolver::resolve_dynamic_call(CallInfo&, BootstrapInfo&, Thread*)+0x1e
V [libjvm.dylib+0x727280] LinkResolver::resolve_invokedynamic(CallInfo&, constantPoolHandle const&, int, Thread*)+0x80
V [libjvm.dylib+0x502f44] InterpreterRuntime::resolve_invokedynamic(JavaThread*)+0x174
V [libjvm.dylib+0x5030d0] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x120
j org.jruby.util.cli.Options.<clinit>()V+3665 org.jruby.dist
v ~StubRoutines::call_stub
V [libjvm.dylib+0x5098e2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2d2
V [libjvm.dylib+0x4e7f14] InstanceKlass::call_class_initializer(Thread*)+0x254
V [libjvm.dylib+0x4e7591] InstanceKlass::initialize_impl(Thread*)+0x5b1
V [libjvm.dylib+0x724630] LinkResolver::resolve_field(fieldDescriptor&, LinkInfo const&, Bytecodes::Code, bool, Thread*)+0x5b0
V [libjvm.dylib+0x724060] LinkResolver::resolve_field_access(fieldDescriptor&, constantPoolHandle const&, int, methodHandle const&, Bytecodes::Code, Thread*)+0x40
V [libjvm.dylib+0x501c05] InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)+0x1c5
V [libjvm.dylib+0x502feb] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x3b
j org.jruby.util.log.LoggerFactory.<clinit>()V+0 org.jruby.dist
v ~StubRoutines::call_stub
V [libjvm.dylib+0x5098e2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2d2
V [libjvm.dylib+0x4e7f14] InstanceKlass::call_class_initializer(Thread*)+0x254
V [libjvm.dylib+0x4e7591] InstanceKlass::initialize_impl(Thread*)+0x5b1
V [libjvm.dylib+0x7248a3] LinkResolver::resolve_static_call(CallInfo&, LinkInfo const&, bool, Thread*)+0x73
V [libjvm.dylib+0x726dd0] LinkResolver::resolve_invoke(CallInfo&, Handle, constantPoolHandle const&, int, Bytecodes::Code, Thread*)+0x80
V [libjvm.dylib+0x502922] InterpreterRuntime::resolve_invoke(JavaThread*, Bytecodes::Code)+0x342
V [libjvm.dylib+0x503006] InterpreterRuntime::resolve_from_cache(JavaThread*, Bytecodes::Code)+0x56
j org.jruby.Main.<clinit>()V+2 org.jruby.dist
v ~StubRoutines::call_stub
V [libjvm.dylib+0x5098e2] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x2d2
V [libjvm.dylib+0x4e7f14] InstanceKlass::call_class_initializer(Thread*)+0x254
V [libjvm.dylib+0x4e7591] InstanceKlass::initialize_impl(Thread*)+0x5b1
V [libjvm.dylib+0x567121] get_method_id(JNIEnv_*, _jclass*, char const*, char const*, bool, Thread*)+0x191
V [libjvm.dylib+0x5674b8] jni_GetStaticMethodID+0xd8
C [libjli.dylib+0x4e6b] JavaMain+0xbcb
C [libjli.dylib+0x7519] ThreadJavaMain+0x9
C [libsystem_pthread.dylib+0x32eb] _pthread_body+0x7e
C [libsystem_pthread.dylib+0x6249] _pthread_start+0x42
C [libsystem_pthread.dylib+0x240d] thread_start+0xd
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.jruby.util.cli.Options.<clinit>()V+3665 org.jruby.dist
v ~StubRoutines::call_stub
j org.jruby.util.log.LoggerFactory.<clinit>()V+0 org.jruby.dist
v ~StubRoutines::call_stub
j org.jruby.Main.<clinit>()V+2 org.jruby.dist
v ~StubRoutines::call_stub
siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000004
Register to memory mapping:
RAX=0x0 is NULL
RBX=0x0 is NULL
RCX=0x0000000000000001 is an unknown value
RDX=0x0 is NULL
RSP=0x00007000045db210 is pointing into the stack for thread: 0x00007ff93e000800
RBP=0x00007000045db240 is pointing into the stack for thread: 0x00007ff93e000800
RSI=0x0 is NULL
RDI=0x0 is NULL
R8 =0x00007ff93e000800 is a thread
R9 =0x0 is NULL
R10=0x00007ff93dd0b530 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
R11=0x0 is NULL
R12=0x0 is NULL
R13=0x0 is NULL
R14=0x0000000000000001 is an unknown value
- backported by
-
JDK-8259745 JRuby crashes while resolving invokedynamic instruction
-
- Resolved
-
-
JDK-8260133 JRuby crashes while resolving invokedynamic instruction
-
- Resolved
-
- relates to
-
JDK-8261090 Store old classfiles in static CDS archive
-
- Resolved
-