jna 对 shutdown hook 中的 kernel32.CreateToolhelp32Snapshot 的调用导致虚拟机崩溃
如果线程使用
Runtime.getRuntime().addShutdownHook();
jna 方法调用来设置关闭钩子:
kernel32.CreateToolhelp32Snapshot (0x00000002, 0)
它会使 VM 崩溃。 如果我在挂钩中调用相同的方法
WindowListener.windowClosing()
,该调用不会使虚拟机崩溃。
知道为什么吗?
如果有任何用处,我可以发布部分虚拟机崩溃错误报告。
编辑:请参阅 pastebin 上的虚拟机崩溃报告
If a thread sets a shutdown hook using
Runtime.getRuntime().addShutdownHook();
calls via jna the method:
kernel32.CreateToolhelp32Snapshot (0x00000002, 0)
it crashes the VM.
If I call the same method in the
WindowListener.windowClosing()
hook, the call does not crashes the VM.
Any idea why?
I can post part of the VM crash error report if it could be of any use.
edit: see the VM crash report on pastebin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发布虚拟机崩溃报告应该会有所帮助。
Posting the VM crash report should help.
将部分崩溃报告发布在pastebin 或类似的网站上,也许有些人可以从中获取一些信息。
好吧,我不确定,但是如果您阅读
addShutdownHook()
这些让我得出这样的结论:也许调用这样的方法要么需要 JVM 中不再可用的服务,要么这个调用花费的时间太长。
Post part of the crash report on pastebin or the like maybe some can get some info out of that.
Well I don't know for sure but if you read the java doc for
addShutdownHook()
these leads me to the conclusion that maybe calling such a method either needs services from the JVM that aren't available anymore or that this call takes too long.