mengnankkkk commented on PR #2852: URL: https://github.com/apache/fory/pull/2852#issuecomment-3468354290
@chaokunyang Hello, I've implemented the basic checking phase as you requested, but I'm encountering a problem: ThreadPoolFory manages multiple Fory serialization instances. When one thread starts serializing/deserializing an instance, another thread calls registerCallback to register a new class. registerCallback attempts to apply the new class to all Fory instances in the pool, including the one currently being used by thread A or already used. Since the instance's internal state (such as the class ID mapping table) might have been "frozen" (Finalized) during the first serialization, attempting to register a new class at this point would corrupt its state, causing failure. Using a synchronization lock would result in poor performance. Adding a volatile boolean global variable and checking this flag in the registerCallback method would immediately throw an IllegalStateException if the flag is true (meaning the "execution phase" has begun), preventing the registration. However, this causes many tests to fail, which seems inconsistent with multithreading requirements. How should I handle this problem?! Help! -- 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]
