[16]RFR(S):8249092:InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code

Paul Sandoz paul.sandoz at oracle.com
Thu Sep 3 19:20:10 UTC 2020


I also agree, the fix should be backed out.

VarHandles can be used as a replacement for Unsafe.

If a VarHandle is used to access the contents of a byte[] or ByteBuffer [1] then only the set/get methods are supported for misaligned access, use of all other methods will throw an IllegalStateException.

Paul.

[1] https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/invoke/MethodHandles.html#byteBufferViewVarHandle(java.lang.Class,java.nio.ByteOrder) <https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/invoke/MethodHandles.html#byteBufferViewVarHandle(java.lang.Class,java.nio.ByteOrder)>

> On Sep 3, 2020, at 1:41 AM, Andrew Haley <aph at redhat.com> wrote:
> 
> On 03/09/2020 05:11, David Holmes wrote:
>> On 3/09/2020 1:49 pm, Wang Zhuo(Zhuoren) wrote:
>>> David, Thank you very much for the explanation.
>>> The original crash indeed happened in a third party code using Unsafe to 
>>> handle unaligned data.
>>> So you mean that it is the third party code's bug, we should not fix it 
>>> in JVM, right?
>> 
>> Right. Unsafe is not a supported API and is by definition unsafe. If you 
>> use it and it crashes then you need to change your code.
> 
> I agree. I hindsight, I should probably not have approved 8246051. I'm happy
> that it should be backed out.
> 
> -- 
> Andrew Haley  (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
> 



More information about the hotspot-runtime-dev mailing list