java.lang.InternalError:最近在编译的Java代码中不安全的内存访问操作中发生了错误 [英] java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code

查看:2868
本文介绍了java.lang.InternalError:最近在编译的Java代码中不安全的内存访问操作中发生了错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道某些JVM专家是否可以简要解释以下错误.从技术上讲,这实际上是什么意思,导致该错误的事件顺序是什么?

I was wondering if some of the JVM gurus out there can briefly explain the following error. What does it actually mean in technical terms and what are the sequences of events that can lead to this error?

java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code

推荐答案

此错误表示sun.misc.Unsafe.getX()putX()内存访问导致

This error means that sun.misc.Unsafe.getX() or putX() memory access resulted in SIGBUS error, which was then caught by JVM and translated to asynchronous InternalError.

更多细节:

  • sun.misc.Unsafe is JDK private API that allows to access native memory directly from Java. This API is a foundation for Direct ByteBuffers and particularly MappedByteBuffers.
  • In certain cases an access to memory-mapped region of a file may lead to OS-level exception, namely SIGBUS. Typical examples are:

  1. 基础文件被截断后,将访问内存映射的缓冲区.
  2. 网络驱动器上的文件已映射到内存,并且在网络连接丢失后可以访问映射的缓冲区.
  3. 尝试写入映射到tmpfs文件系统上文件的页面会导致内存不足(默认情况下,tmpfs空间受限于总RAM的50%).
  1. A memory-mapped buffer is accessed after the underlying file has been truncated.
  2. A file on a network drive has been mapped to memory, and the mapped buffer is accessed after the network connection has been lost.
  3. An attempt to write to a page mapped to a file on tmpfs filesystem results in out-of-memory (by default tmpfs space is limited by 50% of total RAM).

  • HotSpot JVM无法预先有效地检测到这些问题.它将Unsafe.getX / putX调用编译为简单的内存访问指令.额外检查内存区域是否有效将太昂贵.

  • HotSpot JVM cannot efficiently detect these problems beforehand. It compiles Unsafe.getX / putX calls to a simple memory access instruction. Additional checks to see if a memory region is valid would be too expensive.

    请参见

    See JDK-4454115 comments describing the solution for the related JDK bug.

    这篇关于java.lang.InternalError:最近在编译的Java代码中不安全的内存访问操作中发生了错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆