Java 异常访问冲突?

发布于 2024-09-14 07:38:42 字数 2316 浏览 7 评论 0原文

我目前正在编写一个 JNI 项目,在尝试运行 Java 代码时收到以下错误日志。它告诉我有问题的框架是 jvm.dll 框架,在尝试隔离问题时,我试图找出我的问题到底在哪里(在 JVM 中与我的本机代码中)我已附加了线程日志的一部分,并且可以根据需要附加其余部分。我也尝试过重新安装 JVM。

检测到致命错误 Java运行时环境:

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

JRE 版本:6.0_21-b07 Java 虚拟机: Java HotSpot(TM) 客户端虚拟机 (17.0-b17 混合模式,共享 windows-x86 ) 有问题的框架:V [jvm.dll+0xfefb5]

--------------- 线程 ---------------

当前线程(0x02189000): JavaThread“主”[_thread_in_vm, id=3128, 堆栈(0x02120000,0x02170000)]

siginfo:异常代码=0xc0000005, 读取地址0x00000000

寄存器:EAX=0x00000000, EBX=0x02189118,ECX=0x02189000, EDX=0x6da2f76c ESP=0x0216fa84, EBP=0x0216facc,ESI=0x02189000, EDI=0x00000000 EIP=0x6d8fefb5, EFLAGS=0x00010246

堆栈顶部:(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

说明:(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

堆栈:[0x02120000,0x02170000], sp=0x0216fa84,免费 space=13e0216f568k 本机帧: (J=编译的Java代码,j=解释的, Vv=VM 代码,C=本机代码)V [jvm.dll+0xfefb5] C [PNMain.dll+0x19c1a] C [PNMain.dll+0x199d3] j PNMain.optimalSideTwist2(ILjava/lang/String;Lvtk/vtkPolyDataAlgorithm;DDDDDD)[D+0 j PNMain.rotateLeftRight(Z)[D+282 j PNMain.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 框架:(J=编译的 Java 代码, j=解释的,Vv=VM 代码)j PNMain.optimalSideTwist2(ILjava/lang/String;Lvtk/vtkPolyDataAlgorithm;DDDDDD)[D+0 j PNMain.rotateLeftRight(Z)[D+282 j PNMain.main([Ljava/lang/String;)V+92 v ~StubRoutines::call_stub

I'm currently writing a JNI project where I'm getting the following error log when trying to run my Java code. It tells me that the problematic frame is a jvm.dll one, and in trying to isolate the problem, I'm trying to work out where exactly my problem is (in the JVM vs. my native code) I've attached the thread section of the log, and can append the rest if needed. I also tried reinstalling the JVM.

A fatal error has been detected by the
Java Runtime Environment:

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

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

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

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

siginfo: ExceptionCode=0xc0000005,
reading address 0x00000000

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

Top of 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 frames:
(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/lang/String;Lvtk/vtkPolyDataAlgorithm;DDDDDD)[D+0
j PNMain.rotateLeftRight(Z)[D+282 j
PNMain.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/lang/String;Lvtk/vtkPolyDataAlgorithm;DDDDDD)[D+0
j PNMain.rotateLeftRight(Z)[D+282 j
PNMain.main([Ljava/lang/String;)V+92 v
~StubRoutines::call_stub

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

星星的轨迹 2024-09-21 07:38:42

为了使您的调试更容易,我们可以排除 JVM 有问题(在 99.99% 的情况下这不是问题),请查看您的代码。首先简单地删除 JNI 调用并查看机制是否正确完成。然后,在仔细检查所有内存分配和释放后,开始慢慢添加代码片段。您可以使用调试器来访问您的代码,也可以这样做。

也许您可以将 DLL 缩减为产生问题的最小代码段,然后将代码发布到此处,以便其他人运行它并在您遇到困难时查看它?

如果有帮助的话,导致崩溃的方法是optimalSideTwist2。这可能不是导致问题的方法。如果您在不同的方法之间分配内存,您可能会释放不属于您的内存,或者可能会覆盖内存。

To make your debugging easier we can rule out that the JVM has a problem (in 99.99 % of cases it is not the problem), Look in your code. Start by simply stubbing out your JNI call and seeing if the mechanics are properly done. Then start adding pieces of code slowly, after you have inspected all memory allocations and deallocations carefully. You could use a debugger to access your code and go that way also.

Maybe you could reduce your DLL to the smallest piece of code that produces the problem and post the code here for others to run it and look at it if you are stuck ?

The method that caused the crash is optimalSideTwist2 if that helps. That may not be the method that caused the problem. If you are alocating memory between different methods you might be freeing memory that is not yours, or you may be overwriting memory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文