我写了一个JVMTI代理,在运行带有特定jvmti代理的应用程序时,jvm崩溃并退出EXCEPTION_ACCESS_VIOLATION(0xc0000005)。
有问题的框架在于我写的jvmti代理。 stacktrace显示了对getstaticbyte和getstaticint函数的一些jni调用。 当我在调试器下运行它时,不会再现crash / exception_access_violation。跑步是完全正常的。 在调试器外运行时可能导致崩溃的原因是什么?
从崩溃中获得的hs_err_pid _ ***如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000064abfb3c, pid=5968, tid=0x0000000000001a30
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [libCppDynamicLibrary_1.dll+0x3fb3c]
#
# 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
# 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 (0x000000000215e800): JavaThread "main" [_thread_in_native, id=6704, stack(0x0000000002370000,0x0000000002470000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000010
Registers:
RAX=0x0000000000000010, RBX=0x0000000000000042, RCX=0x0000000000000000, RDX=0x0000000000000000
RSP=0x000000000246e190, RBP=0x000000000246e1b0, RSI=0x0000000000000001, RDI=0x0000000000000001
R8 =0x0000000054feabe8, R9 =0x0000000054feabe8, R10=0x000000000215f368, R11=0x0000000055115390
R12=0x0000000000000000, R13=0x0000000000000000, R14=0x0000000000000000, R15=0x0000000000000000
RIP=0x0000000064abfb3c, EFLAGS=0x0000000000010202
Top of Stack: (sp=0x000000000246e190)
0x000000000246e190: 0000000000000000 0000000054feabe8
0x000000000246e1a0: 0000000064acc2b0 000000000246e230
0x000000000246e1b0: 000000000246e210 0000000064ac0b5f
0x000000000246e1c0: 000000000246e1e0 0000000000000000
0x000000000246e1d0: 0000000054feabe8 000000005fecba3e
0x000000000246e1e0: 0000000053a53560 000000000215cf50
0x000000000246e1f0: 0000000053a53560 000000006fce2e7a
0x000000000246e200: 000000000246e210 0000000000000000
0x000000000246e210: 0000000000000042 0000000000000001
0x000000000246e220: 000000000246e250 0000000064ab69e0
0x000000000246e230: 0000000000000000 0000000054fead20
0x000000000246e240: 0000000054feabe8 000000006fce4c59
0x000000000246e250: 000000000246e280 0000000064aa92c2
0x000000000246e260: 0000000000000000 0000000054fead20
0x000000000246e270: 0000000000000000 0000000000000000
0x000000000246e280: 000000000246e310 0000000064a8306a
Instructions: (pc=0x0000000064abfb3c)
0x0000000064abfb1c: 90 90 90 90 55 48 89 e5 48 83 ec 20 48 89 4d 10
0x0000000064abfb2c: 48 89 55 18 48 8b 45 18 48 89 c1 e8 64 0d 00 00
0x0000000064abfb3c: 48 8b 10 48 8b 45 10 48 89 10 48 8b 45 18 48 89
0x0000000064abfb4c: c1 e8 fe f5 ff ff 48 8b 10 48 8b 45 10 48 89 50
Register to memory mapping:
RAX=0x0000000000000010 is an unknown value
RBX=0x0000000000000042 is an unknown value
RCX=0x0000000000000000 is an unknown value
RDX=0x0000000000000000 is an unknown value
RSP=0x000000000246e190 is pointing into the stack for thread: 0x000000000215e800
RBP=0x000000000246e1b0 is pointing into the stack for thread: 0x000000000215e800
RSI=0x0000000000000001 is an unknown value
RDI=0x0000000000000001 is an unknown value
R8 =0x0000000054feabe8 is an unknown value
R9 =0x0000000054feabe8 is an unknown value
R10=0x000000000215f368 is an unknown value
R11=0x0000000055115390 is an unknown value
R12=0x0000000000000000 is an unknown value
R13=0x0000000000000000 is an unknown value
R14=0x0000000000000000 is an unknown value
R15=0x0000000000000000 is an unknown value
Stack: [0x0000000002370000,0x0000000002470000], sp=0x000000000246e190, free space=1016k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libCppDynamicLibrary_1.dll+0x3fb3c]
C [libCppDynamicLibrary_1.dll+0x40b5f]
C [libCppDynamicLibrary_1.dll+0x369e0]
C [libCppDynamicLibrary_1.dll+0x292c2]
C [libCppDynamicLibrary_1.dll+0x306a]
C [libCppDynamicLibrary_1.dll+0x3b31]
C [libCppDynamicLibrary_1.dll+0x27cfc]
C [libCppDynamicLibrary_1.dll+0x1b2c]
C [libCppDynamicLibrary_1.dll+0x20c7]
V [jvm.dll+0x1b7fa6]
V [jvm.dll+0xb89ea]
C 0x0000000002769a38
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j javaapplication1.JavaApplication1.main([Ljava/lang/String;)V+77
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x0000000053b12800 JavaThread "Service Thread" daemon [_thread_blocked, id=7716, stack(0x0000000054850000,0x0000000054950000)]
0x0000000053ac9000 JavaThread "C1 CompilerThread1" daemon [_thread_blocked, id=3960, stack(0x0000000054e40000,0x0000000054f40000)]
0x0000000053abf000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=5724, stack(0x0000000054d40000,0x0000000054e40000)]
0x0000000053aba000 JavaThread "Attach Listener" daemon [_thread_blocked, id=6436, stack(0x0000000054b80000,0x0000000054c80000)]
0x0000000053ab8000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=7540, stack(0x00000000549d0000,0x0000000054ad0000)]
0x0000000053a9f000 JavaThread "Finalizer" daemon [_thread_blocked, id=6944, stack(0x0000000054670000,0x0000000054770000)]
0x0000000053a55800 JavaThread "Reference Handler" daemon [_thread_blocked, id=3156, stack(0x00000000543f0000,0x00000000544f0000)]
=>0x000000000215e800 JavaThread "main" [_thread_in_native, id=6704, stack(0x0000000002370000,0x0000000002470000)]
Other Threads:
0x0000000053a4d800 VMThread [stack: 0x0000000054540000,0x0000000054640000] [id=4316]
0x0000000054fd3800 WatcherThread [stack: 0x0000000055490000,0x0000000055590000] [id=7732]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap:
PSYoungGen total 9728K, used 714K [0x00000000f5a00000, 0x00000000f6480000, 0x0000000100000000)
eden space 8704K, 8% used [0x00000000f5a00000,0x00000000f5ab28e0,0x00000000f6280000)
from space 1024K, 0% used [0x00000000f6380000,0x00000000f6380000,0x00000000f6480000)
to space 1024K, 0% used [0x00000000f6280000,0x00000000f6280000,0x00000000f6380000)
ParOldGen total 22016K, used 0K [0x00000000e0e00000, 0x00000000e2380000, 0x00000000f5a00000)
object space 22016K, 0% used [0x00000000e0e00000,0x00000000e0e00000,0x00000000e2380000)
Metaspace used 2999K, capacity 4486K, committed 4864K, reserved 1056768K
class space used 333K, capacity 386K, committed 512K, reserved 1048576K
Card table byte_map: [0x0000000011b00000,0x0000000011c00000] byte_map_base: 0x00000000113f9000
Marking Bits: (ParMarkBitMap*) 0x000000006046b6d0
Begin Bits: [0x0000000012190000, 0x0000000012958000)
End Bits: [0x0000000012958000, 0x0000000013120000)
Polling page: 0x0000000000340000
CodeCache: size=245760Kb used=1063Kb max_used=1068Kb free=244696Kb
bounds [0x0000000002740000, 0x00000000029b0000, 0x0000000011740000]
total_blobs=232 nmethods=0 adapters=147
compilation: enabled
Compilation events (0 events):
No events
GC Heap History (0 events):
No events
Deoptimization events (0 events):
No events
Internal exceptions (10 events):
Event: 4.248 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': genericInfo> (0x00000000f5a8c070) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.248 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': enumConstants> (0x00000000f5a8c2c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.248 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': enumConstantDirectory> (0x00000000f5a8c520) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.248 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': annotationData> (0x00000000f5a8c770) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.248 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': annotationType> (0x00000000f5a8c9c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.249 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': classValueMap> (0x00000000f5a8cc10) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.249 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': value> (0x00000000f5a8ce50) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.250 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': next> (0x00000000f5a8d088) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.250 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': next> (0x00000000f5a8d2c0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Event: 4.250 Thread 0x000000000215e800 Exception <a 'java/lang/NoSuchFieldError': x> (0x00000000f5a8d4f8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u121\8372\hotspot\src\share\vm\prims\jni.cpp, line 2965]
Events (10 events):
Event: 4.191 loading class java/lang/Void
Event: 4.192 loading class java/lang/Void done
Event: 4.193 loading class javaapplication1/hello
Event: 4.193 loading class javaapplication1/hello done
Event: 4.245 Executing VM operation: GetOrSetLocal
Event: 4.246 Executing VM operation: GetOrSetLocal done
Event: 4.246 loading class java/lang/NoSuchFieldError
Event: 4.247 loading class java/lang/NoSuchFieldError done
Event: 4.249 Executing VM operation: GetOrSetLocal
Event: 4.250 Executing VM operation: GetOrSetLocal done
Dynamic libraries:
0x000000013fdf0000 - 0x000000013fe27000 C:\Program Files\Java\jdk1.8.0_121\bin\java.exe
0x0000000077ac0000 - 0x0000000077c6a000 C:\windows\SYSTEM32\ntdll.dll
0x00000000778a0000 - 0x00000000779bf000 C:\windows\system32\kernel32.dll
0x000007fefd7c0000 - 0x000007fefd82a000 C:\windows\system32\KERNELBASE.dll
0x000007feffc90000 - 0x000007feffd6b000 C:\windows\system32\ADVAPI32.dll
0x000007feff6f0000 - 0x000007feff78f000 C:\windows\system32\msvcrt.dll
0x000007fefe150000 - 0x000007fefe16f000 C:\windows\SYSTEM32\sechost.dll
0x000007fefdb60000 - 0x000007fefdc8d000 C:\windows\system32\RPCRT4.dll
0x00000000779c0000 - 0x0000000077aba000 C:\windows\system32\USER32.dll
0x000007fefe170000 - 0x000007fefe1d7000 C:\windows\system32\GDI32.dll
0x000007feff790000 - 0x000007feff79e000 C:\windows\system32\LPK.dll
0x000007fefdce0000 - 0x000007fefddaa000 C:\windows\system32\USP10.dll
0x000007fefc060000 - 0x000007fefc254000 C:\windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll
0x000007feff8e0000 - 0x000007feff951000 C:\windows\system32\SHLWAPI.dll
0x000007feff7a0000 - 0x000007feff7ce000 C:\windows\system32\IMM32.DLL
0x000007feff7d0000 - 0x000007feff8d9000 C:\windows\system32\MSCTF.dll
0x0000000061520000 - 0x00000000615f2000 C:\Program Files\Java\jdk1.8.0_121\jre\bin\msvcr100.dll
0x000000005fc50000 - 0x00000000604eb000 C:\Program Files\Java\jdk1.8.0_121\jre\bin\server\jvm.dll
0x000007fef5e60000 - 0x000007fef5e69000 C:\windows\system32\WSOCK32.dll
0x000007fefdc90000 - 0x000007fefdcdd000 C:\windows\system32\WS2_32.dll
0x000007fefde50000 - 0x000007fefde58000 C:\windows\system32\NSI.dll
0x000007fefafe0000 - 0x000007fefb01b000 C:\windows\system32\WINMM.dll
0x000007fefc840000 - 0x000007fefc84c000 C:\windows\system32\VERSION.dll
0x0000000077c90000 - 0x0000000077c97000 C:\windows\system32\PSAPI.DLL
0x000000006e8d0000 - 0x000000006e8df000 C:\Program Files\Java\jdk1.8.0_121\jre\bin\verify.dll
0x000000006e870000 - 0x000000006e899000 C:\Program Files\Java\jdk1.8.0_121\jre\bin\java.dll
0x0000000064a80000 - 0x0000000064d79000 C:\Users\siddharth\Documents\NetBeansProjects\CppDynamicLibrary_1\dist\Debug\MinGW64-Windows\libCppDynamicLibrary_1.dll
0x0000000061440000 - 0x000000006145c000 C:\msys64\mingw64\bin\libgcc_s_seh-1.dll
0x0000000064940000 - 0x0000000064955000 C:\msys64\mingw64\bin\libwinpthread-1.dll
0x000000006fc40000 - 0x000000006fda1000 C:\msys64\mingw64\bin\libstdc++-6.dll
0x0000000066330000 - 0x0000000066346000 C:\Program Files\Java\jdk1.8.0_121\jre\bin\zip.dll
0x000007fefe3c0000 - 0x000007feff14a000 C:\windows\system32\SHELL32.dll
0x000007feff150000 - 0x000007feff353000 C:\windows\system32\ole32.dll
0x000007fefd7a0000 - 0x000007fefd7af000 C:\windows\system32\profapi.dll
0x000007fef5fa0000 - 0x000007fef60c5000 C:\windows\system32\dbghelp.dll
VM Arguments:
jvm_args: -agentpath:C:\\Users\\siddharth\\Documents\\NetBeansProjects\\CppDynamicLibrary_1\\dist\\Debug\\MinGW64-Windows\\libCppDynamicLibrary_1.dll
java_command: C:\\Users\\siddharth\\Documents\\NetBeansProjects\\JavaApplication1\\dist\\JavaApplication1.jar
java_class_path (initial): C:\\Users\\siddharth\\Documents\\NetBeansProjects\\JavaApplication1\\dist\\JavaApplication1.jar
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=C:\msys\1.0\bin;C:\Perl64\site\bin;C:\Perl64\bin;C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\CMake\bin;C:\Program Files\nodejs\;C:\msys64\mingw64\bin;C:\msys64\usr\bin;C:\Users\Guest\AppData\Local\Code\bin;C:\Program Files (x86)\LLVM\bin;C:\Program Files (x86)\Nmap;c:\Program Files\Java\jdk1.8.0_121\bin;C:\Users\Guest\AppData\Roaming\npm;C:\msys64\mingw64\bin;C:\msys\1.0\bin
USERNAME=siddharth
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows 7 , 64 bit Build 7601 (6.1.7601.23677)
CPU:total 2 (2 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, clmul, tsc, tscinvbit
Memory: 4k page, physical 2039664k(275996k free), swap 5401696k(968952k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (25.121-b13) for windows-amd64 JRE (1.8.0_121-b13), built on Dec 12 2016 18:21:36 by "java_re" with MS VC++ 10.0 (VS2010)
time: Sun Apr 09 12:59:39 2017
elapsed time: 4 seconds (0d 0h 0m 4s)