Java access violation exception?

I am currently writing a JNI project where I am getting the following error log when trying to run Java code. This tells me that the problem frame is jvm.dll, and trying to isolate the problem, I try to solve where exactly my problem (in the JVM and my native code) I have bound the thread to the log section and can add the rest if necessary. I also tried reinstalling the JVM.

A fatal error was detected by the Java Runtime Environment:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) with pc = 0x6d8fefb5, pid = 720, tid = 3128

JRE version: 6.0_21-b07 Java VM: Java Virtual Machine HotSpot (TM) (17.0-b17) mixed mode, windows x86 sharing) Problem frame: V [Jvm.dll + 0xfefb5]

--------------- THREAD ---------------

Current thread (0x02189000): JavaThread "main" [_thread_in_vm, id = 3128, stack (0x02120000,0x02170000)]

siginfo: ExceptionCode = 0xc0000005, read address 0x00000000

Registers: EAX = 0x00000000, EBX = 0x02189118, ECX = 0x02189000, EDX = 0x6da2f76c ESP = 0x0216fa84, EBP = 0x0216facc, ESI = 0x02189000, EDI = 0x00000000 EIP = 0x6d8fefb5, 0x002424

Top of the stack: (sp = 0x0216fa84) 0x0216fa84: 0216fb38 0216fae4 34497370 0216faa0 0x0216fa94:
6d8010e0 02189000 0216fd34 0216fad0 0x0216faa4: 6d906d09 02189000 00000006 00000004 0x0216fab4:
0216fb38 0216fae8 02189000 02189a08 0x0216fac4: 000004c4 6da2f76c 0216faf0 57669c1a 0x0216fad4:
02189118 0216fbf0 00000000 0216fb04 0x0216fae4: 0216fb04 cccccccc 0216fb04 0216fb38 0x0216faf4:
576699d3 02189118 0216fbf0 00000000

Instructions: (pc = 0x6d8fefb5) 0x6d8fefa5: 00 00 00 74 08 8d 4d f0 e8 1e 20 09 00 8b 7d 10 0x6d8fefb5:
8b 07 c7 45 e0 0c 00 00 00 8b 48 08 0f b7 51 2a

Stack: [0x02120000,0x02170000], sp = 0x0216fa84, free space = 13e0216f568k Native framework: (J = compiled Java code, j = interpreted, Vv = VM code, C = native code) V [jvm.dll + 0xfefb5] C [PNMain.dll + 0x19c1a] C [PNMain.dll + 0x199d3] j PNMain.optimalSideTwist2 (ILjava / languages ​​/ String; Lvtk / vtkPolyDataAlgorithm; DDDDDD) [D = + 0 j PNMain.rotateLeftRight (Z) [D + 282 .main ([Ljava / lang / String;) V + 92 v ~ StubRoutines :: call_stub V [jvm.dll + 0xf3abc] V [jvm.dll + 0x1865b1] V [jvm.dll + 0xf3b3d] V [jvm.dll + 0xfd385] V [jvm.dll + 0x104fdd] C [javaw.exe + 0x2155] C [javaw.exe + 0x8614] C [kernel32.dll + 0x13677] C [ntdll.dll + 0x39d42] C [Ntdll.dll + 0x39d15]

Java frames: (J = compiled Java code, j = interpreted, Vv = VM code) j PNMain.optimalSideTwist2 (ILjava / languages ​​/ String; Lvtk / vtkPolyDataAlgorithm; DDDDDD) [D = + 0 j PNMain.rotateLeftRight (Z) [D + 282 j PNMain.main ([Ljava / lang / String;) V + 92 v ~ StubRoutines :: call_stub

+6
java jvm crash jni crash-dumps
source share
1 answer

To facilitate your debugging, we can exclude that the JVM has a problem (in 99.99% of cases this is not a problem). Look into your code. Start by simply ending your JNI call and verifying that the mechanics are working properly. Then start adding code snippets slowly, after carefully inspecting all memory allocations and freeing up memory. You can use the debugger to access your code and go the same way.

Perhaps you could reduce your DLL to the smallest part of the code that poses the problem, and place the code here for others to run it and look at it if you are stuck?

The method that caused the failure is optimal SideTwist2 if that helps. This may not be the method that caused the problem. If you allocate memory between different ways, you can free up memory that does not belong to you, or you can overwrite memory.

+3
source share

All Articles