JDK-8072588 : JVM crashes in JNI if toString is declared as an interface method
Type:Bug
Component:hotspot
Sub-Component:runtime
Affected Version:8,9
Priority:P3
Status:Resolved
Resolution:Fixed
Submitted:2015-02-05
Updated:2015-10-29
Resolved:2015-06-02
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.
Crash in assert on debug. 0 pointer result on product. Looks like regression after JDK-8014013
Comments
Method::_vtable_index is positive and holder is interface. Looks incorrect:
(gdb) bt
#0 0x00007fdc640aa619 in __libc_waitpid (pid=32420, stat_loc=0x7fdc647c2ea8, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40
#1 0x00007fdc62f705d8 in os::fork_and_exec (cmd=0x7fdc63baf500 <VMError::report_and_die()::buffer> "gdb /proc/32404/exe 32404") at /home/lev/code/jdk9/dev/hotspot/src/os/linux/vm/os_linux.cpp:5924
#2 0x00007fdc6318dbd9 in VMError::show_message_box (this=0x7fdc647c31b0, buf=0x7fdc63baf500 <VMError::report_and_die()::buffer> "gdb /proc/32404/exe 32404", buflen=2000)
at /home/lev/code/jdk9/dev/hotspot/src/os/linux/vm/vmError_linux.cpp:60
#3 0x00007fdc6318c77a in VMError::report_and_die (this=0x7fdc647c31b0) at /home/lev/code/jdk9/dev/hotspot/src/share/vm/utilities/vmError.cpp:883
#4 0x00007fdc62994b80 in report_vm_error (file=0x7fdc632e7dc0 "/home/lev/code/jdk9/dev/hotspot/src/share/vm/oops/method.hpp", line=459, error_msg=0x7fdc632e7e00 "assert(valid_itable_index()) failed",
detail_msg=0x7fdc632e7d9d "") at /home/lev/code/jdk9/dev/hotspot/src/share/vm/utilities/debug.cpp:217
#5 0x00007fdc6292bbfe in Method::itable_index (this=0x7fdc4c83d5d8) at /home/lev/code/jdk9/dev/hotspot/src/share/vm/oops/method.hpp:459
#6 0x00007fdc62c8607a in jni_invoke_nonstatic (env=0x7fdc5c00fa38, result=0x7fdc647c3500, receiver=0x7fdc5c0fa078, call_type=JNI_VIRTUAL, method_id=0x7fdc5c198e68, args=0x7fdc647c3530, __the_thread__=0x7fdc5c00f800)
at /home/lev/code/jdk9/dev/hotspot/src/share/vm/prims/jni.cpp:1153
#7 0x00007fdc62c8b9ae in jni_CallObjectMethodV(JNIEnv *, jobject, jmethodID, typedef __va_list_tag __va_list_tag *) (env=0x7fdc5c00fa38, obj=0x7fdc5c0fa078, methodID=0x7fdc5c198e68, args=0x7fdc647c3608)
at /home/lev/code/jdk9/dev/hotspot/src/share/vm/prims/jni.cpp:1483
#8 0x00007fdc3e7b273c in JNIEnv_::CallObjectMethodV (this=0x7fdc5c00fa38, obj=0x7fdc5c0fa078, methodID=0x7fdc5c198e68, args=0x7fdc647c3608) at /home/lev/Downloads/8u20x64/include/jni.h:907
#9 0x00007fdc3e7b1ddf in callStringMethod (env=0x7fdc5c00fa38, jobj=0x7fdc5c0fa078, id=0x7fdc5c198e68) at Test.cpp:17
#10 0x00007fdc3e7b24bc in Java_test_Test_nTest (env=0x7fdc5c00fa38, jobj=0x7fdc647c37d0) at Test.cpp:113
#11 0x00007fdc4d0281bf in ?? ()
#12 0x00007fdc647c3780 in ?? ()
#13 0x00007fdc4c83c690 in ?? ()
#14 0x00007fdc647c37d8 in ?? ()
#15 0x00007fdc4c83c700 in ?? ()
#16 0x0000000000000000 in ?? ()
(gdb) frame 5
#5 0x00007fdc6292bbfe in Method::itable_index (this=0x7fdc4c83d5d8) at /home/lev/code/jdk9/dev/hotspot/src/share/vm/oops/method.hpp:459
459 int itable_index() const { assert(valid_itable_index(), "");
(gdb) call 'Method::print_on(outputStream*) const'(this, tty)
{method}
- this oop: 0x00007fdc4c83d5d8
- method holder: 'test/InterfaceWithToString'
- constants: 0x00007fdc4c83d440 constant pool [11] {0x00007fdc4c83d440} for 'test/InterfaceWithToString' cache=0x00007fdc4c83d8a0
- access: 0x401 public abstract
- name: 'toString'
- signature: '()Ljava/lang/String;'
- max stack: 1
- max locals: 0
- size of params: 1
- method size: 12
- vtable index: 2
- i2i entry: 0x00007fdc4d0210c0
- adapters: AHE@0x00007fdc5c0ba550: 0x i2c: 0x0000000000000000 c2i: 0x00007fdc4d105f00 c2iUV: 0x00007fdc4d105f00
- compiled entry 0x00007fdc4d105f00
- code size: 0
- checked ex length: 0
- localvar length: 0
13-02-2015
Assignee change as per JBS assignment
13-02-2015
this decision http://hg.openjdk.java.net/jdk9/dev/hotspot/file/e0947f58c9c1/src/share/vm/prims/jni.cpp#l1126 goes to else branch before crash. Look like bug is somewhere while getting wrong jmethodID while resolving it through jni_CallObjectMethodV .