Community
Participate
Working Groups
Build Identifier: version: June release Build id: 20120604-1722 The problem arises when I'm debugging a Java 1.7 program that uses a method handle. When I hold the mouse cursor above the variable 'mh' in the editor, the following message appears in the console window and the debugged vm terminates. FATAL ERROR in native method: JDWP on checking for an array class, jvmtiError=JV MTI_ERROR_INVALID_CLASS(21) JDWP exit error JVMTI_ERROR_INVALID_CLASS(21): on checking for an array class [. ./../../src/share/back/util.c:1297] # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d35a7af, pid=1776, tid=2980 # # JRE version: 7.0_05-b05 # Java VM: Java HotSpot(TM) Client VM (23.1-b03 mixed mode windows-x86 ) # Problematic frame: # C [jdwp.dll+0x1a7af] I'm not sure if this is a bug in Eclipse or in JDK but I think it's a good idea to show you first. I'v attached a simple program to reproduce the bug. Reproducible: Always Steps to Reproduce: 1. create a project with the following code: ---------------------------------------------- package test; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; import java.lang.reflect.Method; public class JDWPTest { public static void main(String[] args) { try { Method m = JDWPTest.class.getMethod("myMethod", int.class, int.class); Lookup lookup = MethodHandles.lookup(); MethodHandle mh = lookup.unreflect(m); mh.invoke(1,2); } catch (Throwable e) { e.printStackTrace(); } } public static void myMethod(int a, int b) { System.out.println(a + ", " + b); } } ---------------------------------------------- 2. Put a breakpoint on "mh.invoke(1,2);" and start a debug session. 3. When the breakpoint hit, put the cursor on "mh".
Reproduced using Oracle 1.7.3 found a related VM bug: http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=9a5af62623b957acae0a34a366e?bug_id=6559275 The cause of the bug is coming from an issued request JDIFieldVariable#retrieveValue(). Once we issue the request of the VM it immediately terminates and any following attempts to get JDI infos immediately fail with VMDisconnectedExceptions. The field that seems to trigger it is 'type' from java.lang.invoke.DirectMethodHandle - which actually comes from its parent class java.lang.invoke.MethodHandle. The odd thing is that we do not get any reply at all from the VM when we make the request, the VM simply disconnects leaving me a error file with the following in it (and the exception mentioned in comment #0): # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006d272598, pid=5996, tid=4448 # # JRE version: 7.0_03-b03 # Java VM: Java HotSpot(TM) 64-Bit Server VM (22.1-b02 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [jdwp.dll+0x22598] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x000000000683f800): JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=4448, stack(0x0000000008330000,0x0000000008430000)] siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000000
> # > # If you would like to submit a bug report, please visit: > # http://bugreport.sun.com/bugreport/crash.jsp > # The crash happened outside the Java Virtual Machine in native code. > # See problematic frame for where to report the bug. > # Thank you for examining this. So probably there is a bug on the side of the VM (after all JVMTI shouldn't break even if it has received an invalid request). In addition it happens related to a MethodHandle what is a new feature in JDK 7. Do you think I could report this problem at bugreport.sun.com, or make a comment on the bug you have mentioned?
(In reply to comment #2) > > # > > # If you would like to submit a bug report, please visit: > > # http://bugreport.sun.com/bugreport/crash.jsp > > # The crash happened outside the Java Virtual Machine in native code. > > # See problematic frame for where to report the bug. > > # > > Thank you for examining this. So probably there is a bug on the side of the VM > (after all JVMTI shouldn't break even if it has received an invalid request). > In addition it happens related to a MethodHandle what is a new feature in JDK > 7. > > Do you think I could report this problem at bugreport.sun.com, or make a > comment on the bug you have mentioned? I would definitely comment on the bug. If they mention its not related, then open a new one.
> I would definitely comment on the bug. If they mention its not related, then > open a new one. It happened. I wasn't able to comment on the old bug so I've reported a new one. Here is a link for reference however the bug is not visible yet. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7183485
(In reply to comment #4) > > I would definitely comment on the bug. If they mention its not related, then > > open a new one. > > It happened. I wasn't able to comment on the old bug so I've reported a new > one. Here is a link for reference however the bug is not visible yet. > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7183485 The bug has been accepted by Oracle (thanks for reporting it Kálmán) and since there is nothing for Eclipse to fix, I am closing this as NOT_ECLIPSE. I am going to tag this as a readme, so we can make note of it in the 3.9/4.3 release.
> The bug has been accepted by Oracle (thanks for reporting it Kálmán) and since > there is nothing for Eclipse to fix, I am closing this as NOT_ECLIPSE. I am > going to tag this as a readme, so we can make note of it in the 3.9/4.3 > release. Yeah, they accepted it. Thanks for your support, Michael.