Access violation 0xc0000005 when exiting with JNI Cygwin code on Windows XP
I'm stumped. I have a JNI code that works on Ubuntu 11 and MacOSX but is causing problems on Windows.
JRE version: 6.0_31-b05 OS: Windows XP with gcc 4. Modified jni_md.h to avoid _int64 compilation error: http://www.vtk.org/pipermail/vtkusers/2006-May/085047.html
The code is built and run using Maven. The error occurs when running our unit test, which works fine on Ubuntu 11 and MacOSX.
Several observations.
1) There was one function that returns String. This will cause the unit test to hang. Signature here.
JNIEXPORT jstring JNICALL Java_com_ctrlworks_puppet_driver_DefaultDriver_Get_1FW_1Version(
JNIEnv *env, jobject obj) {
2) Taking a function out of a call and modifying a unit test respectively results in the unit test running without errors, but causing an access violation on exit.
Stack trace:
Current thread (0x02c1ac00): VMThread [stack: 0x02d00000,0x02d50000] [id=3360]
siginfo: ExceptionCode=0xc0000005, reading address 0x02d4de30
Registers:
EAX=0x02d4ce64, EBX=0x001b2b28, ECX=0x00000001, EDX=0x00000001
ESP=0x02d4fc14, EBP=0x02d4fc5c, ESI=0x02d4fc70, EDI=0x00000000
EIP=0x6102879e, EFLAGS=0x00010212
EAX=
[error occurred during error reporting (printing register info), id 0xc0000005]
Stack: [0x02d00000,0x02d50000], sp=0x02d4fc14, free space=319k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [cygwin1.dll+0x2879e] dll_noncygwin_dllcrt0+0x1e
C [ntdll.dll+0x118a] LdrInitializeThunk+0x24
C [ntdll.dll+0x23aba] RtlDestroyEnvironment+0x178
C [kernel32.dll+0x1ca96] IsValidLocale+0x8eb
C [kernel32.dll+0x1cb0e] ExitProcess+0x14
C [msvcr71.dll+0x8d04] exit+0x0
C [msvcr71.dll+0x8d11] exit+0xd
V [jvm.dll+0x11d88d]
V [jvm.dll+0x11cb9e]
V [jvm.dll+0x11cec2]
V [jvm.dll+0x11d2d2]
V [jvm.dll+0x140ffc]
C [msvcr71.dll+0x9565] endthreadex+0xa0
C [kernel32.dll+0xb713] GetModuleFileNameA+0x1b4
VM_Operation (0x009efb80): Exit, mode: safepoint, requested by thread 0x003b7000
Your help is most appreciated. I'm a complete Windows newbie and it doesn't help. I tried to learn Visual C ++ 2010 but got a lot of compilation errors, so I figured I was better off with Cygwin. We also have some scripting logic in BASH, so we need the Cygwin environment anyway.
source to share