jni调用C++ dll崩溃

小春❤文君 发布于 2018/07/17 13:40
阅读 707
收藏 0

【华为云1024程序员节·向云而生】预约直播 抽14件华为电子产品礼包!>>>


1、重写C++ dll封装第三方dll







# A fatal error has been detected by the Java Runtime Environment:
#  EXCEPTION_STACK_OVERFLOW (0xc00000fd) at pc=0x1551bf37, pid=6124, tid=0x00002268
# JRE version: Java(TM) SE Runtime Environment (8.0_171-b11) (build 1.8.0_171-b11)
# Java VM: Java HotSpot(TM) Client VM (25.171-b11 mixed mode windows-x86 )
# Problematic frame:
# C  [FingerVein_v3_dev.dll+0x2bf37]
# 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 (0x009cd000):  JavaThread "main" [_thread_in_native, id=8808, stack(0x00240000,0x00290000)]

siginfo: ExceptionCode=0xc00000fd, ExceptionInformation=0x00000000 0x00240000 

EAX=0x00240000, EBX=0x00000000, ECX=0x0022d878, EDX=0x14ea9500
ESP=0x0028f3e0, EBP=0x0028f3f8, ESI=0x00000000, EDI=0x14f45d88
EIP=0x1551bf37, EFLAGS=0x00010206

Top of Stack: (sp=0x0028f3e0)
0x0028f3e0:   2ac26b0f 154f711f 2ac26b0f 0028f5c8
0x0028f3f0:   1551d23c ffffffff 0028f444 154f3b62
0x0028f400:   00000000 1551e520 00000000 009cd000
0x0028f410:   14c309d8 14c309d8 155ca710 009cd9c4
0x0028f420:   000003ec 0285ae66 009cb278 000014b4
0x0028f430:   009cd000 0028f45c 6ca913c0 009cd000
0x0028f440:   2aea9f4b 0028f458 154f3d45 00000000
0x0028f450:   00000000 155ca710 0028f468 60641713 

Instructions: (pc=0x1551bf37)
0x1551bf17:   1b c0 f7 d0 23 c8 8b c4 25 00 f0 ff ff 3b c8 72
0x1551bf27:   0a 8b c1 59 94 8b 00 89 04 24 c3 2d 00 10 00 00
0x1551bf37:   85 00 eb e9 cc cc cc cc cc 83 3d c4 a7 5c 15 00
0x1551bf47:   74 2d 55 8b ec 83 ec 08 83 e4 f8 dd 1c 24 f2 0f 

Register to memory mapping:

EAX=0x00240000 is an unknown value
EBX=0x00000000 is an unknown value
ECX=0x0022d878 is an unknown value
EDX=0x14ea9500 is an unknown value
ESP=0x0028f3e0 is pointing into the stack for thread: 0x009cd000
EBP=0x0028f3f8 is pointing into the stack for thread: 0x009cd000
ESI=0x00000000 is an unknown value
EDI=0x14f45d88 is an unknown value

Stack: [0x00240000,0x00290000],  sp=0x0028f3e0,  free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [FingerVein_v3_dev.dll+0x2bf37]
C  [FingerVein_v3_dev.dll+0x3b62]
C  [FingerVein_v3_dev.dll+0x3d45]
C  [ZKMDFingerVein.dll+0x1713]  Java_com_zkteco_fingervein_invoker_ZKMDFingerVein_ZKMDFingerVein_1Open+0x13
j  com.zkteco.fingervein.invoker.ZKMDFingerVein.ZKMDFingerVein_Open(I)I+0
j  Test.main([Ljava/lang/String;)V+23
v  ~StubRoutines::call_stub
V  [jvm.dll+0x15b985]
V  [jvm.dll+0x22262e]
V  [jvm.dll+0x15ba1e]
V  [jvm.dll+0xdd3a7]
V  [jvm.dll+0xe593f]
C  [javaw.exe+0x233a]
C  [javaw.exe+0xb020]
C  [javaw.exe+0xb0aa]
C  [kernel32.dll+0x1343d]
C  [ntdll.dll+0x39832]
C  [ntdll.dll+0x39805]
C  0x00000000

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.zkteco.fingervein.invoker.ZKMDFingerVein.ZKMDFingerVein_Open(I)I+0
j  Test.main([Ljava/lang/String;)V+23
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
  0x14ec6400 JavaThread "Service Thread" daemon [_thread_blocked, id=2828, stack(0x15300000,0x15350000)]
  0x14ec0000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=3944, stack(0x150a0000,0x150f0000)]
  0x14ebf000 JavaThread "Attach Listener" daemon [_thread_blocked, id=2616, stack(0x152a0000,0x152f0000)]
  0x14ed3400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2736, stack(0x151c0000,0x15210000)]
  0x14ea8000 JavaThread "Finalizer" daemon [_thread_blocked, id=8420, stack(0x04930000,0x04980000)]
  0x14e82000 JavaThread "Reference Handler" daemon [_thread_blocked, id=9120, stack(0x04980000,0x049d0000)]
=>0x009cd000 JavaThread "main" [_thread_in_native, id=8808, stack(0x00240000,0x00290000)]

Other Threads:
  0x14e7ac00 VMThread [stack: 0x048d0000,0x04920000] [id=8540]
  0x14ec7400 WatcherThread [stack: 0x154a0000,0x154f0000] [id=7996]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

 def new generation   total 4928K, used 708K [0x04a00000, 0x04f50000, 0x09f50000)
  eden space 4416K,  16% used [0x04a00000, 0x04ab1120, 0x04e50000)
  from space 512K,   0% used [0x04e50000, 0x04e50000, 0x04ed0000)
  to   space 512K,   0% used [0x04ed0000, 0x04ed0000, 0x04f50000)
 tenured generation   total 10944K, used 0K [0x09f50000, 0x0aa00000, 0x14a00000)
   the space 10944K,   0% used [0x09f50000, 0x09f50000, 0x09f50200, 0x0aa00000)
 Metaspace       used 1693K, capacity 2246K, committed 2368K, reserved 4480K

Card table byte_map: [0x004d0000,0x00560000] byte_map_base: 0x004ab000

Polling page: 0x000c0000

CodeCache: size=32768Kb used=669Kb max_used=669Kb free=32098Kb
 bounds [0x02810000, 0x028b8000, 0x04810000]
 total_blobs=154 nmethods=14 adapters=72
 compilation: enabled

Compilation events (10 events):
Event: 0.075 Thread 0x14ec0000   10             java.lang.Character::toLowerCase (9 bytes)
Event: 0.075 Thread 0x14ec0000 nmethod 10 0x028b6148 code [0x028b6250, 0x028b62f8]
Event: 0.075 Thread 0x14ec0000   11             java.lang.CharacterDataLatin1::toLowerCase (39 bytes)
Event: 0.075 Thread 0x14ec0000 nmethod 11 0x028b6388 code [0x028b6480, 0x028b6560]
Event: 0.075 Thread 0x14ec0000   12             java.lang.AbstractStringBuilder::ensureCapacityInternal (27 bytes)
Event: 0.075 Thread 0x14ec0000 nmethod 12 0x028b6648 code [0x028b6760, 0x028b6928]
Event: 0.075 Thread 0x14ec0000   13             java.lang.AbstractStringBuilder::append (29 bytes)
Event: 0.075 Thread 0x14ec0000 nmethod 13 0x028b6a08 code [0x028b6b20, 0x028b6d28]
Event: 0.078 Thread 0x14ec0000   14             java.lang.String::indexOf (166 bytes)
Event: 0.078 Thread 0x14ec0000 nmethod 14 0x028b6ec8 code [0x028b6fe0, 0x028b7210]

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Classes redefined (0 events):
No events

Internal exceptions (2 events):
Event: 0.028 Thread 0x009cd000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.defineClass(Ljava/lang/String;[BII)Ljava/lang/Class; name or signature does not match> (0x04a06ea8) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u171\10807\hotspot\src\shar
Event: 0.028 Thread 0x009cd000 Exception <a 'java/lang/NoSuchMethodError': Method sun.misc.Unsafe.prefetchRead(Ljava/lang/Object;J)V name or signature does not match> (0x04a07178) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u171\10807\hotspot\src\share\vm\prims\jni.cpp

Events (10 events):
Event: 0.077 loading class sun/launcher/LauncherHelper$FXHelper
Event: 0.077 loading class sun/launcher/LauncherHelper$FXHelper done
Event: 0.077 loading class java/lang/Class$MethodArray
Event: 0.077 loading class java/lang/Class$MethodArray done
Event: 0.077 loading class java/lang/Void
Event: 0.077 loading class java/lang/Void done
Event: 0.078 loading class com/zkteco/fingervein/invoker/ZKMDFingerVein
Event: 0.078 loading class com/zkteco/fingervein/invoker/ZKMDFingerVein done
Event: 0.078 loading class java/lang/Package
Event: 0.078 loading class java/lang/Package done

Dynamic libraries:
0x01200000 - 0x01233000     C:\Program Files (x86)\Java\jdk1.8.0_171\bin\javaw.exe
0x77de0000 - 0x77f60000     C:\Windows\SysWOW64\ntdll.dll
0x75a10000 - 0x75b20000     C:\Windows\syswow64\kernel32.dll
0x779b0000 - 0x779f7000     C:\Windows\syswow64\KERNELBASE.dll
0x77870000 - 0x77911000     C:\Windows\syswow64\ADVAPI32.dll
0x774e0000 - 0x7758c000     C:\Windows\syswow64\msvcrt.dll
0x77050000 - 0x77069000     C:\Windows\SysWOW64\sechost.dll
0x75dd0000 - 0x75ec0000     C:\Windows\syswow64\RPCRT4.dll
0x758e0000 - 0x75940000     C:\Windows\syswow64\SspiCli.dll
0x758d0000 - 0x758dc000     C:\Windows\syswow64\CRYPTBASE.dll
0x75c80000 - 0x75d80000     C:\Windows\syswow64\USER32.dll
0x77390000 - 0x77420000     C:\Windows\syswow64\GDI32.dll
0x75a00000 - 0x75a0a000     C:\Windows\syswow64\LPK.dll
0x75950000 - 0x759ed000     C:\Windows\syswow64\USP10.dll
0x72150000 - 0x722ee000     C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_41e855142bd5705d\COMCTL32.dll
0x76cf0000 - 0x76d47000     C:\Windows\syswow64\SHLWAPI.dll
0x77420000 - 0x77480000     C:\Windows\system32\IMM32.DLL
0x76b10000 - 0x76bdc000     C:\Windows\syswow64\MSCTF.dll
0x78840000 - 0x788ff000     C:\Program Files (x86)\Java\jdk1.8.0_171\jre\bin\msvcr100.dll
0x6ca10000 - 0x6cde1000     C:\Program Files (x86)\Java\jdk1.8.0_171\jre\bin\client\jvm.dll
0x6e0d0000 - 0x6e0d7000     C:\Windows\system32\WSOCK32.dll
0x77480000 - 0x774b5000     C:\Windows\syswow64\WS2_32.dll
0x77760000 - 0x77766000     C:\Windows\syswow64\NSI.dll
0x73850000 - 0x73882000     C:\Windows\system32\WINMM.dll
0x74fc0000 - 0x74fc9000     C:\Windows\system32\VERSION.dll
0x77280000 - 0x77285000     C:\Windows\syswow64\PSAPI.DLL
0x60820000 - 0x6082c000     C:\Program Files (x86)\Java\jdk1.8.0_171\jre\bin\verify.dll
0x584b0000 - 0x584d2000     C:\Program Files (x86)\Java\jdk1.8.0_171\jre\bin\java.dll
0x5e760000 - 0x5e774000     C:\Program Files (x86)\Java\jdk1.8.0_171\jre\bin\zip.dll
0x75ec0000 - 0x76b0b000     C:\Windows\syswow64\SHELL32.dll
0x75b20000 - 0x75c7d000     C:\Windows\syswow64\ole32.dll
0x75810000 - 0x7581b000     C:\Windows\system32\profapi.dll
0x60640000 - 0x60649000     F:\projects\ZKMDFingerVein\Release\ZKMDFingerVein.dll
0x6d630000 - 0x6d6a1000     C:\Windows\system32\MSVCP120.dll
0x6ed00000 - 0x6edee000     C:\Windows\system32\MSVCR120.dll
0x154f0000 - 0x155d0000     C:\Windows\FingerVein_v3_dev.dll
0x6f910000 - 0x6f979000     C:\Windows\system32\MSVCP100.dll
0x155d0000 - 0x157c3000     C:\Program Files (x86)\Java\jdk1.8.0_171\bin\opencv_core243.dll
0x157d0000 - 0x159d7000     C:\Program Files (x86)\Java\jdk1.8.0_171\bin\opencv_highgui243.dll
0x772f0000 - 0x77381000     C:\Windows\syswow64\OLEAUT32.dll
0x50bc0000 - 0x50bd9000     C:\Windows\system32\AVIFIL32.dll
0x6ea50000 - 0x6ea64000     C:\Windows\system32\MSACM32.dll
0x6f050000 - 0x6f071000     C:\Windows\system32\MSVFW32.dll
0x6f0e0000 - 0x6f0f3000     C:\Windows\system32\AVICAP32.dll
0x159e0000 - 0x15c3d000     C:\Program Files (x86)\Java\jdk1.8.0_171\bin\opencv_imgproc243.dll
0x76d50000 - 0x76eed000     C:\Windows\syswow64\SETUPAPI.dll
0x77980000 - 0x779a7000     C:\Windows\syswow64\CFGMGR32.dll
0x774c0000 - 0x774d2000     C:\Windows\syswow64\DEVOBJ.dll
0x772c0000 - 0x772ef000     C:\Windows\syswow64\WINTRUST.dll
0x76ef0000 - 0x77011000     C:\Windows\syswow64\CRYPT32.dll
0x75940000 - 0x7594c000     C:\Windows\syswow64\MSASN1.dll
0x6eec0000 - 0x6efab000     C:\Windows\system32\dbghelp.dll

VM Arguments:
jvm_args: -Dfile.encoding=GBK 
java_command: Test
java_class_path (initial): F:\Eclipse Project\ZKMDFingerVein\bin
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_171
CLASSPATH=C:\Program Files (x86)\Java\jdk1.8.0_171\lib;C:\Program Files (x86)\Java\jdk1.8.0_171\lib\tools.jar
PATH=C:/Program Files (x86)/Java/jdk1.8.0_171/bin/../jre/bin/client;C:/Program Files (x86)/Java/jdk1.8.0_171/bin/../jre/bin;C:/Program Files (x86)/Java/jdk1.8.0_171/bin/../jre/lib/i386;C:\Program Files (x86)\Java\jdk1.8.0_171\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.8.0_171\bin;F:\Program Files\TortoiseSVN\bin;F:\Eclipse Project\apache-maven-3.5.4\bin;E:\Program Files\CMake\bin;F:\软件\eclipse442win32\eclipse442win32\eclipse;
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 9, GenuineIntel

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

OS: Windows 7 , 64 bit Build 7601 (6.1.7601.24150)

CPU:total 4 (initial active 4) (4 cores per cpu, 1 threads per core) family 6 model 158 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, tsc, tscinvbit, bmi1, bmi2, adx

Memory: 4k page, physical 8273868k(3603368k free), swap 16545860k(11572456k free)

vm_info: Java HotSpot(TM) Client VM (25.171-b11) for windows-x86 JRE (1.8.0_171-b11), built on Mar 28 2018 14:51:22 by "java_re" with MS VC++ 10.0 (VS2010)

time: Tue Jul 17 13:33:43 2018
elapsed time: 0 seconds (0d 0h 0m 0s)