cuihaohao opened a new issue, #2326:
URL: https://github.com/apache/fory/issues/2326

   ### Question
   
   I’m encountering a ClassCastException when using Fury with 
withAsyncCompilation(true) enabled. The issue only happens during the first 
serialization and does not occur when I disable async compilation 
(withAsyncCompilation(false)). The environment is a large-scale Java service 
deployed on a server; the issue doesn’t reproduce in minimal test cases locally.
   
   💡 Setup:
        •       Fury version: 0.4.1
        •       Language: Java
        •       RPC framework: [Motan](https://github.com/weibocom/motan)
        •       Serialization configuration:
   
   `Fury.builder()
       .withLanguage(Language.JAVA)
       .withRefTracking(true)
       .requireClassRegistration(false)
       .withAsyncCompilation(true)
       .withCompatibleMode(CompatibleMode.COMPATIBLE)
       .withDeserializeUnexistedClass(true)
       .buildThreadSafeFury();`
   
   Exception:
   `Caused by: java.lang.ClassCastException: com.ch.businessModel.PetInfo 
cannot be cast to java.lang.Integer
        at 
io.fury.serializer.PrimitiveSerializers$IntSerializer.write(PrimitiveSerializers.java:161)
        at 
io.fury.serializer.collection.AbstractCollectionSerializer.compatibleWrite(AbstractCollectionSerializer.java:338)
        at 
io.fury.serializer.collection.AbstractCollectionSerializer.writeElements(AbstractCollectionSerializer.java:314)
        at 
io.fury.serializer.collection.AbstractCollectionSerializer.write(AbstractCollectionSerializer.java:296)
        at io.fury.Fury.writeNonRef(Fury.java:442)
        at 
io.fury.serializer.CompatibleSerializer.writeSeparateFieldValue(CompatibleSerializer.java:218)
        at 
io.fury.serializer.CompatibleSerializer.readAndWriteFieldValue(CompatibleSerializer.java:153)
        at 
io.fury.serializer.CompatibleSerializer.write(CompatibleSerializer.java:108)
        at io.fury.Fury.writeData(Fury.java:551)
        at io.fury.Fury.writeRef(Fury.java:344)
        at io.fury.Fury.write(Fury.java:319)
        at io.fury.Fury.serialize(Fury.java:255)
        at io.fury.Fury.serialize(Fury.java:221)
        at io.fury.ThreadLocalFury.serialize(ThreadLocalFury.java:67)
        at 
com.ch.serialize.FurySerialization.serialize(FurySerialization.java:39)
        at com.ch.codec.MotanV2ECodec.encode(MotanV2ECodec.java:137)
        ...`
   
   Model Structure:
   
   One of the RPC response objects includes:
   `private List<PetInfo> petInfoList;`
   
   Where PetInfo is a regular POJO in com.ch.businessModel.
   
   ❓ My Questions:
        1.      What might be causing this ClassCastException during async 
compilation?
        2.      Is this issue related to Java’s type erasure or generic types 
in collections?
        3.      Could this be a race condition or incorrect type inference 
during Fury’s async class generation?
        4.      Is there any recommended workaround until the root cause is 
fixed?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to