fury
fury copied to clipboard
[java] Fory failed serialization in arm64 openjdk25
Search before asking
- [x] I had searched in the issues and found no similar issues.
Version
version: 0.12.3 openjdk: 25 os: Arch Linux aarch64
Component(s)
Java
Minimal reproduce step
public final class ForyFactory {
private static final ForyFactory FACTORY = new ForyFactory();
private final ThreadSafeFory fory = new ForyBuilder().withLanguage(Language.JAVA)
// enable reference tracking for shared/circular reference.
// Disable it will have better performance if no duplicate reference.
.withRefTracking(false)
// compress int for smaller size
.withIntCompressed(true)
// compress long for smaller size
.withLongCompressed(true)
// enable type forward/backward compatibility
// disable it for small size and better performance.
.withCompatibleMode(CompatibleMode.COMPATIBLE)
// enable async multi-threaded compilation.
.withAsyncCompilation(true)
.requireClassRegistration(false)
.buildThreadSafeFory();
public static ForyFactory getFuryFactory() {
return FACTORY;
}
public byte[] serialize(Object object) {
if (object == null) {
return new byte[0];
}
return fory.serialize(object);
}
public Object deserialize(byte[] bytes) {
if (bytes == null) {
return null;
}
return fory.deserialize(bytes);
}
}
What did you expect to see?
Successful serialization
What did you see instead?
### Error updating database. Cause: org.apache.fory.exception.SerializationException: java.lang.InternalError: a fault occurred in an unsafe memory access operation
### The error occurred while executing an update
### Cause: org.apache.fory.exception.SerializationException: java.lang.InternalError: a fault occurred in an unsafe memory access operation] with root cause
java.lang.InternalError: a fault occurred in an unsafe memory access operation
at java.base/jdk.internal.misc.Unsafe.putLong(Native Method) ~[?:?]
at [email protected]/sun.misc.Unsafe.putLong(Unsafe.java:370) ~[?:?]
at org.apache.fory.memory.MemoryBuffer.writeInt64(MemoryBuffer.java:714) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.serializer.CompatibleSerializer.write(CompatibleSerializer.java:95) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.serializer.collection.ChildContainerSerializers$ChildCollectionSerializer.onCollectionWrite(ChildContainerSerializers.java:145) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.serializer.collection.ChildContainerSerializers$ChildCollectionSerializer.onCollectionWrite(ChildContainerSerializers.java:126) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.serializer.collection.CollectionLikeSerializer.write(CollectionLikeSerializer.java:317) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.Fory.writeData(Fory.java:652) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.Fory.write(Fory.java:403) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.Fory.serialize(Fory.java:323) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.Fory.serialize(Fory.java:295) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
at org.apache.fory.ThreadLocalFory.serialize(ThreadLocalFory.java:98) ~[fory-core-0.13.0-SNAPSHOT.jar!/:0.13.0-SNAPSHOT]
Anything Else?
No response
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Would it possible be some memory alignment issue in JDK unsafe?
Would it possible be some memory alignment issue in JDK unsafe?
I was able to serialize successfully using the default serialization tool in JDK, but when I encountered problems using Fory, I simply called the 'serialize' method, and I'm not sure if it's a compatibility issue with the operating system?
We don't support Arch Linux aarch64 yet, I guess it's Unsafe memory operation unaligned issue