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

Wang Zhuo(Zhuoren) zhuoren.wz at alibaba-inc.com
Fri Sep 4 02:00:18 UTC 2020


OK, thanks all.
I am creating new bug and making patch to revert 8246051.

Regards,
Zhuoren


------------------------------------------------------------------
From:Paul Sandoz <paul.sandoz at oracle.com>
Sent At:2020 Sep. 4 (Fri.) 03:22
To:Andrew Haley <aph at redhat.com>
Cc:David Holmes <david.holmes at oracle.com>; Sandler <zhuoren.wz at alibaba-inc.com>; Patric Hedlin <patric.hedlin at oracle.com>; aarch64-port-dev <aarch64-port-dev at openjdk.java.net>; hotspot-runtime-dev <hotspot-runtime-dev at openjdk.java.net>; rahul.v.raghavan <rahul.v.raghavan at oracle.com>
Subject:Re: [16]RFR(S):8249092:InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code

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)


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