fury icon indicating copy to clipboard operation
fury copied to clipboard

refactor: objectstreamserializer to use meta shared compatible

Open kitalkuyo-gita opened this issue 2 months ago • 4 comments

Why?

What does this PR do?

Related issues

Related to issue-2622

Does this PR introduce any user-facing change?

  • [ ] Does this PR introduce any public API change?
  • [ ] Does this PR introduce any binary protocol compatibility change?

Benchmark

kitalkuyo-gita avatar Oct 22 '25 02:10 kitalkuyo-gita

Great! Could we remove https://github.com/apache/fory/blob/main/java/fory-core/src/main/java/org/apache/fory/serializer/CompatibleSerializer.java and https://github.com/apache/fory/blob/main/java/fory-core/src/main/java/org/apache/fory/resolver/FieldResolver.java in this PR too?

chaokunyang avatar Oct 22 '25 03:10 chaokunyang

Great! Could we remove https://github.com/apache/fory/blob/main/java/fory-core/src/main/java/org/apache/fory/serializer/CompatibleSerializer.java and https://github.com/apache/fory/blob/main/java/fory-core/src/main/java/org/apache/fory/resolver/FieldResolver.java in this PR too?

Hello, @chaokunyang . I see these two classes are marked as deprecated. However, I believe further discussion is needed regarding their removal. Completely removing these classes would impact backward compatibility. Therefore, I recommend retaining the CompatibleSerializer in non-meta-shared mode and using the ObjectStreamMetaSharedSerializerAdapter only in meta-shared mode.

Restore the conditional for useMetaShare in SlotsInfo.

Non-meta-shared mode: Use the CompatibleSerializer.

Meta-shared mode: Use the ObjectStreamMetaSharedSerializerAdapter.

What do you think about this?

kitalkuyo-gita avatar Oct 22 '25 03:10 kitalkuyo-gita

While fixing CI, I encountered a problem. LinkedBlockingQueue and ArrayBlockingQueue both have custom writeObject/readObject methods. According to requireJavaSerialization , they use ObjectStreamSerializer . However, the LinkedBlockingQueue.readObject method calls the add() method during deserialization, which requires a lock. If the serialization lock state is incorrect, a deadlock will occur. The key issue is that LinkedBlockingQueue and ArrayBlockingQueue are not suitable for using ObjectStreamSerializer . JavaSerializer (full JDK serialization) should be used instead.

kitalkuyo-gita avatar Oct 22 '25 10:10 kitalkuyo-gita

@chaokunyang Hello, it's ready.

kitalkuyo-gita avatar Oct 23 '25 04:10 kitalkuyo-gita