Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8144481

Invalid method ordering after redefine classes

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: 8u40, 8u65, 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Subcomponent:
      svc

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

      FULL OS VERSION :
      Microsoft Windows [Version 10.0.10586]

      A DESCRIPTION OF THE PROBLEM :
      This crash occurs as a result of modifying a static initializer block by replacing 2 statements with 1 method call statement calling a new method and trying to hot-code replace the newly compiled class file, while the JVM is stopped at a breakpoint in a debugger.

      This happens in Eclipse using the provided source code. The refactoring that triggers the crash changes a static initializer block from this:

      static {
      System.out.println("Let this line remain where it is in <clinit>.");
      System.out.println("Extract a method from this line ONLY to cause the crash.");
      }

      Into this:

      static {
      System.out.println("Let this line remain where it is in <clinit>.");
      init();
      }
      private static void init() {
      System.out.println("Extract a method from this line ONLY to cause the crash.");
      }

      While the main thread is suspended in the main method.

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Set a breakpoint at line 7 in the main method.
      2) Start the application in debugger.
      3) While the main thread is suspended at the breakpoint in main method, change the source code as described in the bug description.
      4) Save the source code and hot-code replace it in the debugged JVM.
      5) The JVM crashes.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected: There is no crash and the main method can continue executing.
      Actual: A crash.
      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005cfa8855, pid=9652, tid=11936
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0_65-b17) (build 1.8.0_65-b17)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.65-b01 mixed mode windows-amd64 compressed oops)
      # Problematic frame:
      # V [jvm.dll+0x128855]
      #
      # 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.java.com/bugreport/crash.jsp
      #

      --------------- T H R E A D ---------------

      Current thread (0x000000001ba65800): JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=11936, stack(0x000000001d3e0000,0x000000001d4e0000)]

      siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff

      Registers:
      RAX=0x000000001d4df401, RBX=0x000000001ba65800, RCX=0x696c412473746573, RDX=0x0000000000000000
      RSP=0x000000001d4df410, RBP=0x696c412473746573, RSI=0x000000001d4df528, RDI=0x00000000022d82f0
      R8 =0x000000001ba65800, R9 =0x0000000000000000, R10=0x0000000000000000, R11=0x0000000000000064
      R12=0x0000000000000000, R13=0x000000001ba664d8, R14=0x0000000000000000, R15=0x0000000000000000
      RIP=0x000000005cfa8855, EFLAGS=0x0000000000010202

      Top of Stack: (sp=0x000000001d4df410)
      0x000000001d4df410: 000000001ba65800 000000001ba65800
      0x000000001d4df420: 000000001d4df4d8 000000005d1ae19b
      0x000000001d4df430: 000000001ba65800 000000005d1ca9fd
      0x000000001d4df440: 0000000000000000 000000005cb99155
      0x000000001d4df450: 000000001da3e250 000000005cba291e
      0x000000001d4df460: 000000001ba65800 0000000000000000
      0x000000001d4df470: 0000000000000000 0000000000000000
      0x000000001d4df480: 696c412473746573 000000005cba1a15
      0x000000001d4df490: 000000001d4df528 000000001d4df500
      0x000000001d4df4a0: 0000000000000001 000000001da3e250
      0x000000001d4df4b0: 696c412473746573 000000005cb853b3
      0x000000001d4df4c0: 000000001d4df5f0 0000000000000001
      0x000000001d4df4d0: 0000000000000001 000000001da3e250
      0x000000001d4df4e0: 0000000000000009 0000000000000000
      0x000000001d4df4f0: 0000000000000000 0000000000000000
      0x000000001d4df500: 0000000000000001 000000005cb85571

      Instructions: (pc=0x000000005cfa8855)
      0x000000005cfa8835: cc cc cc cc cc cc cc cc cc cc cc 48 83 ec 28 48
      0x000000005cfa8845: 85 c9 75 07 33 c0 48 83 c4 28 c3 48 89 5c 24 20
      0x000000005cfa8855: 48 8b 19 48 85 db 74 20 48 83 fb 37 74 1a 48 8b
      0x000000005cfa8865: 13 48 8b cb ff 52 10 84 c0 74 0d 48 8b c3 48 8b


      Register to memory mapping:

      RAX=0x000000001d4df401 is pointing into the stack for thread: 0x000000001ba65800
      RBX=0x000000001ba65800 is a thread
      RCX=0x696c412473746573 is an unknown value
      RDX=0x0000000000000000 is an unknown value
      RSP=0x000000001d4df410 is pointing into the stack for thread: 0x000000001ba65800
      RBP=0x696c412473746573 is an unknown value
      RSI=0x000000001d4df528 is pointing into the stack for thread: 0x000000001ba65800
      RDI=0x00000000022d82f0 is an unknown value
      R8 =0x000000001ba65800 is a thread
      R9 =0x0000000000000000 is an unknown value
      R10=0x0000000000000000 is an unknown value
      R11=0x0000000000000064 is an unknown value
      R12=0x0000000000000000 is an unknown value
      R13=0x000000001ba664d8 is an unknown value
      R14=0x0000000000000000 is an unknown value
      R15=0x0000000000000000 is an unknown value


      Stack: [0x000000001d3e0000,0x000000001d4e0000], sp=0x000000001d4df410, free space=1021k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [jvm.dll+0x128855]
      V [jvm.dll+0x34a9fd]
      C [jdwp.dll+0x21a15]
      C [jdwp.dll+0x53b3]
      C [jdwp.dll+0x5571]
      C [jdwp.dll+0xf0a8]
      C [jdwp.dll+0x1f2d5]
      C [jdwp.dll+0x1f4aa]
      V [jvm.dll+0x1bb8f8]
      V [jvm.dll+0x243144]
      V [jvm.dll+0x299f7a]
      C [msvcr100.dll+0x21d9f]
      C [msvcr100.dll+0x21e3b]
      C [KERNEL32.DLL+0x18102]
      C [ntdll.dll+0x5c264]


      --------------- P R O C E S S ---------------

      Java Threads: ( => current thread )
        0x000000001da28000 JavaThread "Service Thread" daemon [_thread_blocked, id=11164, stack(0x000000001dde0000,0x000000001dee0000)]
        0x000000001ba8e000 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=3264, stack(0x000000001d8e0000,0x000000001d9e0000)]
        0x000000001ba89000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=7684, stack(0x000000001d7e0000,0x000000001d8e0000)]
        0x000000001ba84000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=8260, stack(0x000000001d6e0000,0x000000001d7e0000)]
        0x000000001ba77000 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=7000, stack(0x000000001d5e0000,0x000000001d6e0000)]
        0x000000001ba74000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=11884, stack(0x000000001d4e0000,0x000000001d5e0000)]
      =>0x000000001ba65800 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=11936, stack(0x000000001d3e0000,0x000000001d4e0000)]
        0x000000001ba5a800 JavaThread "Attach Listener" daemon [_thread_blocked, id=2688, stack(0x000000001cfa0000,0x000000001d0a0000)]
        0x000000001ba5a000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5684, stack(0x000000001cea0000,0x000000001cfa0000)]
        0x00000000023d8800 JavaThread "Finalizer" daemon [_thread_blocked, id=3204, stack(0x000000001ccc0000,0x000000001cdc0000)]
        0x000000001ba29000 JavaThread "Reference Handler" daemon [_thread_blocked, id=10784, stack(0x000000001cbc0000,0x000000001ccc0000)]
        0x00000000022de000 JavaThread "main" [_thread_blocked, id=10120, stack(0x0000000002180000,0x0000000002280000)]

      Other Threads:
        0x000000001ba26800 VMThread [stack: 0x000000001cac0000,0x000000001cbc0000] [id=11324]
        0x000000001da3e800 WatcherThread [stack: 0x000000001dee0000,0x000000001dfe0000] [id=8200]

      VM state:not at safepoint (normal execution)

      VM Mutex/Monitor currently owned by a thread: None

      Heap:
       PSYoungGen total 76288K, used 5243K [0x000000076ad80000, 0x0000000770280000, 0x00000007c0000000)
        eden space 65536K, 8% used [0x000000076ad80000,0x000000076b29ec70,0x000000076ed80000)
        from space 10752K, 0% used [0x000000076f800000,0x000000076f800000,0x0000000770280000)
        to space 10752K, 0% used [0x000000076ed80000,0x000000076ed80000,0x000000076f800000)
       ParOldGen total 175104K, used 0K [0x00000006c0800000, 0x00000006cb300000, 0x000000076ad80000)
        object space 175104K, 0% used [0x00000006c0800000,0x00000006c0800000,0x00000006cb300000)
       Metaspace used 2614K, capacity 4486K, committed 4864K, reserved 1056768K
        class space used 281K, capacity 386K, committed 512K, reserved 1048576K

      Card table byte_map: [0x00000000117a0000,0x0000000011fa0000] byte_map_base: 0x000000000e19c000

      Marking Bits: (ParMarkBitMap*) 0x000000005d68a5b0
       Begin Bits: [0x0000000012900000, 0x00000000168e0000)
       End Bits: [0x00000000168e0000, 0x000000001a8c0000)

      Polling page: 0x0000000002040000

      CodeCache: size=245760Kb used=1100Kb max_used=1105Kb free=244659Kb
       bounds [0x00000000023e0000, 0x0000000002650000, 0x00000000113e0000]
       total_blobs=249 nmethods=26 adapters=145
       compilation: enabled

      Compilation events (10 events):
      Event: 0.112 Thread 0x000000001ba8e000 22 3 java.lang.String::equals (81 bytes)
      Event: 0.113 Thread 0x000000001ba8e000 nmethod 22 0x00000000024f0050 code [0x00000000024f01e0, 0x00000000024f0750]
      Event: 0.113 Thread 0x000000001ba8e000 23 3 java.lang.String::indexOf (7 bytes)
      Event: 0.113 Thread 0x000000001ba89000 24 4 java.lang.String::charAt (29 bytes)
      Event: 0.113 Thread 0x000000001ba8e000 nmethod 23 0x00000000024f0950 code [0x00000000024f0ac0, 0x00000000024f0ce8]
      Event: 0.113 Thread 0x000000001ba8e000 25 3 java.lang.AbstractStringBuilder::append (50 bytes)
      Event: 0.113 Thread 0x000000001ba8e000 nmethod 25 0x00000000024f0d90 code [0x00000000024f0f20, 0x00000000024f1448]
      Event: 0.113 Thread 0x000000001ba89000 nmethod 24 0x00000000024f4350 code [0x00000000024f44a0, 0x00000000024f4598]
      Event: 0.117 Thread 0x000000001ba8e000 26 3 java.util.Arrays::copyOfRange (63 bytes)
      Event: 0.117 Thread 0x000000001ba8e000 nmethod 26 0x00000000024f2810 code [0x00000000024f2a20, 0x00000000024f3598]

      GC Heap History (0 events):
      No events

      Deoptimization events (0 events):
      No events

      Internal exceptions (2 events):
      Event: 0.028 Thread 0x00000000022de000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x000000076ad8d420) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u65\4987\hotspot\src\s��M i�?
      Event: 0.028 Thread 0x00000000022de000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x000000076ad8d708) thrown at [C:\workspace\8-2-build-windows-amd64-cygwin\jdk8u65\4987\hotspot\src\share\vm\prims\jni.

      Events (10 events):
      Event: 9.271 Executing VM operation: GetOrSetLocal
      Event: 9.271 Executing VM operation: GetOrSetLocal done
      Event: 9.271 Executing VM operation: GetOrSetLocal
      Event: 9.271 Executing VM operation: GetOrSetLocal done
      Event: 9.271 Executing VM operation: GetOrSetLocal
      Event: 9.271 Executing VM operation: GetOrSetLocal done
      Event: 9.271 Executing VM operation: GetOrSetLocal
      Event: 9.271 Executing VM operation: GetOrSetLocal done
      Event: 16.928 Executing VM operation: RedefineClasses
      Event: 16.928 Executing VM operation: RedefineClasses done


      Dynamic libraries:
      0x00007ff64c5e0000 - 0x00007ff64c617000 C:\Program Files\Java\jdk1.8.0_65\bin\javaw.exe
      0x00007ffaac230000 - 0x00007ffaac3f1000 C:\WINDOWS\SYSTEM32\ntdll.dll
      0x00007ffaaa250000 - 0x00007ffaaa2fd000 C:\WINDOWS\system32\KERNEL32.DLL
      0x00007ffaa90f0000 - 0x00007ffaa92d8000 C:\WINDOWS\system32\KERNELBASE.dll
      0x00007ffaaa4e0000 - 0x00007ffaaa587000 C:\WINDOWS\system32\ADVAPI32.dll
      0x00007ffaa97e0000 - 0x00007ffaa987d000 C:\WINDOWS\system32\msvcrt.dll
      0x00007ffaaa180000 - 0x00007ffaaa1db000 C:\WINDOWS\system32\sechost.dll
      0x00007ffaabf30000 - 0x00007ffaac04c000 C:\WINDOWS\system32\RPCRT4.dll
      0x00007ffaac050000 - 0x00007ffaac1a6000 C:\WINDOWS\system32\USER32.dll
      0x00007ffaaa5d0000 - 0x00007ffaaa756000 C:\WINDOWS\system32\GDI32.dll
      0x00007ffaa43d0000 - 0x00007ffaa4644000 C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.10586.0_none_8c15ae12515e1c22\COMCTL32.dll
      0x00007ffaa9940000 - 0x00007ffaa9bbd000 C:\WINDOWS\system32\combase.dll
      0x00007ffaa8f30000 - 0x00007ffaa8f9a000 C:\WINDOWS\system32\bcryptPrimitives.dll
      0x00007ffaaa590000 - 0x00007ffaaa5cb000 C:\WINDOWS\system32\IMM32.DLL
      0x000000005cbc0000 - 0x000000005cc92000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\msvcr100.dll
      0x000000005ce80000 - 0x000000005d709000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\server\jvm.dll
      0x00007ffaa9880000 - 0x00007ffaa9888000 C:\WINDOWS\system32\PSAPI.DLL
      0x00007ffaa6f50000 - 0x00007ffaa6f73000 C:\WINDOWS\SYSTEM32\WINMM.dll
      0x00007ffaa49d0000 - 0x00007ffaa49da000 C:\WINDOWS\SYSTEM32\VERSION.dll
      0x00007ffaa4e60000 - 0x00007ffaa4e69000 C:\WINDOWS\SYSTEM32\WSOCK32.dll
      0x00007ffaaa1e0000 - 0x00007ffaaa24b000 C:\WINDOWS\system32\WS2_32.dll
      0x0000000002070000 - 0x000000000209c000 C:\WINDOWS\SYSTEM32\WINMMBASE.dll
      0x00007ffaa9580000 - 0x00007ffaa95c3000 C:\WINDOWS\system32\cfgmgr32.dll
      0x000000005cd90000 - 0x000000005cd9f000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\verify.dll
      0x000000005cd60000 - 0x000000005cd89000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\java.dll
      0x000000005cb80000 - 0x000000005cbb5000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\jdwp.dll
      0x000000005cb70000 - 0x000000005cb78000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\npt.dll
      0x000000005cd40000 - 0x000000005cd56000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\zip.dll
      0x00007ffaaa760000 - 0x00007ffaabcbf000 C:\WINDOWS\system32\SHELL32.dll
      0x00007ffaa88e0000 - 0x00007ffaa8f24000 C:\WINDOWS\system32\windows.storage.dll
      0x00007ffaa9bc0000 - 0x00007ffaa9c12000 C:\WINDOWS\system32\shlwapi.dll
      0x00007ffaa88d0000 - 0x00007ffaa88df000 C:\WINDOWS\system32\kernel.appcore.dll
      0x00007ffaa8fa0000 - 0x00007ffaa9055000 C:\WINDOWS\system32\shcore.dll
      0x00007ffaa8850000 - 0x00007ffaa889b000 C:\WINDOWS\system32\powrprof.dll
      0x00007ffaa88b0000 - 0x00007ffaa88c4000 C:\WINDOWS\system32\profapi.dll
      0x000000005cb60000 - 0x000000005cb69000 C:\Program Files\Java\jdk1.8.0_65\jre\bin\dt_socket.dll
      0x00007ffa9cbe0000 - 0x00007ffa9cbf6000 C:\WINDOWS\system32\napinsp.dll
      0x00007ffa9f0e0000 - 0x00007ffa9f0fa000 C:\WINDOWS\system32\pnrpnsp.dll
      0x00007ffaa4aa0000 - 0x00007ffaa4ab8000 C:\WINDOWS\system32\NLAapi.dll
      0x00007ffaa8120000 - 0x00007ffaa817c000 C:\WINDOWS\System32\mswsock.dll
      0x00007ffaa71d0000 - 0x00007ffaa727a000 C:\WINDOWS\SYSTEM32\DNSAPI.dll
      0x00007ffaabdd0000 - 0x00007ffaabdd8000 C:\WINDOWS\system32\NSI.dll
      0x00007ffaa15f0000 - 0x00007ffaa15fd000 C:\WINDOWS\System32\winrnr.dll
      0x00007ffaa0e60000 - 0x00007ffaa0ec7000 C:\WINDOWS\System32\fwpuclnt.dll
      0x00007ffaa8780000 - 0x00007ffaa87a9000 C:\WINDOWS\SYSTEM32\bcrypt.dll
      0x00007ffa9e200000 - 0x00007ffa9e20a000 C:\Windows\System32\rasadhlp.dll
      0x00007ffaa4240000 - 0x00007ffaa43cc000 C:\WINDOWS\SYSTEM32\dbghelp.dll

      VM Arguments:
      jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:51897 -Dfile.encoding=UTF-8
      java_command: test.stuff.CrashRepro
      java_class_path (initial): C:\Users\Timo\workspace-EVE-D\First\classes
      Launcher Type: SUN_STANDARD

      Environment Variables:
      PATH=C:\Program Files\Java\jdk1.8.0_65\jre\bin;C:/Program Files/Java/jdk1.8.0_65/jre/bin/server;C:/Program Files/Java/jdk1.8.0_65/jre/bin;C:/Program Files/Java/jdk1.8.0_65/jre/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft\Web Platform Installer\;D:\Evening-IDE\projects\IDE\target\ide-2;
      USERNAME=Timo
      OS=Windows_NT
      PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel



      --------------- S Y S T E M ---------------

      OS: Windows 10.0 , 64 bit Build 10586 (10.0.10586.0)

      CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 42 stepping 7, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, tsc, tscinvbit

      Memory: 4k page, physical 16737516k(8867684k free), swap 19227884k(8579000k free)

      vm_info: Java HotSpot(TM) 64-Bit Server VM (25.65-b01) for windows-amd64 JRE (1.8.0_65-b17), built on Oct 6 2015 16:39:20 by "java_re" with MS VC++ 10.0 (VS2010)

      time: Sat Nov 28 19:11:19 2015
      elapsed time: 16 seconds (0d 0h 0m 16s)



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test.stuff;

      public class CrashRepro {
      public static void main(String[] args) {
      final boolean DEBUG = false;
      if(DEBUG) return;
      System.out.println("Put a breakpoint on this line, then execute until the debugger stops here");
      }
      static {
      System.out.println("Let this line remain where it is in <clinit>.");
      System.out.println("Extract a method from this line ONLY to cause the crash.");
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Replacing both statements in the static initializer doesn't cause a crash in the test case, but no reliable workaround in general is known at this time.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dsamersoff Dmitriy Samersoff
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: