theigl opened a new issue, #1879: URL: https://github.com/apache/fury/issues/1879
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/fury/issues) and found no similar issues. ### Version 0.8.0 ### Component(s) Java ### Minimal reproduce step I'm trying to serialize the static inner class `DelegatedPage` from [SessionQotaManagingDataStore](https://github.com/wicketstuff/core/blob/master/datastores-parent/datastore-common/src/main/java/org/wicketstuff/datastores/common/SessionQuotaManagingDataStore.java) that is used in Apache Wicket. Fury can serialize the class just fine but as soon as async code generation kicks in, an `IllegalAccessError` is thrown. The following test demonstrates the problem. It does not fail, but it logs the error to the console. If `withAsyncCompilation` is set to `false`, the error goes away. ```java package com.synexit.base.web.util.serializer.repro; import org.apache.fury.Fury; import org.apache.fury.ThreadSafeFury; import org.apache.fury.config.Language; import org.junit.jupiter.api.Test; import java.io.Serializable; import java.util.concurrent.ConcurrentLinkedQueue; import static org.junit.jupiter.api.Assertions.assertNotNull; class JitTest { @Test void shouldSerializeWithAsyncCompilation() throws InterruptedException { final ThreadSafeFury fury = Fury.builder() .withLanguage(Language.JAVA) .requireClassRegistration(false) .withRefTracking(true) .withAsyncCompilation(true) .buildThreadSafeFuryPool(1, 1); final Store store = new Store(); store.addPage(new Store.SerializedPage(1)); final Object v = store.getData(); for (int i = 0; i < 1000; i++) { final byte[] d = fury.serialize(v); final Object deserialized = fury.deserialize(d); assertNotNull(deserialized); } Thread.sleep(1000); for (int i = 0; i < 1000; i++) { final byte[] d = fury.serialize(v); final Object deserialized = fury.deserialize(d); assertNotNull(deserialized); } } public static class Store { public static final class SerializedPage { private final int pageId; public SerializedPage(int pageId) { this.pageId = pageId; } public int getPageId() { return pageId; } } private final CountLimitedData data; public Store() { this.data = new CountLimitedData(1); } public void addPage(SerializedPage page) { this.data.addPage(page); } public Object getData() { return data; } abstract static class SessionData implements Serializable { final ConcurrentLinkedQueue<DelegatedPage> pages = new ConcurrentLinkedQueue(); SessionData() { } synchronized void addPage(SerializedPage page) { this.pages.add(new DelegatedPage(page.getPageId(), 0)); } } static class DelegatedPage implements Serializable { public final int pageId; public final long pageSize; public DelegatedPage(int pageId, long pageSize) { this.pageId = pageId; this.pageSize = pageSize; } } static class CountLimitedData extends SessionData { private final int maxPages; public CountLimitedData(int maxPages) { this.maxPages = maxPages; } } } } ``` ### What did you expect to see? Classes that can be serialized with code generation should be serializable with async code generation as well. ### What did you see instead? ``` java.lang.IllegalAccessError: failed to access class org.wicketstuff.datastores.common.SessionQuotaManagingDataStore$DelegatedPage from class org.wicketstuff.datastores.common.SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0 (org.wicketstuff.datastores.common.SessionQuotaManagingDataStore$DelegatedPage is in unnamed module of loader 'app'; org.wicketstuff.datastores.common.SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0 is in unnamed module of loader org.apache.fury.util.ClassLoaderUtils$ByteArrayClassLoader @31123c7a) at org.wicketstuff.datastores.common.SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0.<init>(SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0.java:59) at org.apache.fury.serializer.Serializers.createSerializer(Serializers.java:129) at org.apache.fury.serializer.Serializers.newSerializer(Serializers.java:104) at org.apache.fury.resolver.ClassResolver$1.onSuccess(ClassResolver.java:941) at org.apache.fury.resolver.ClassResolver$1.onSuccess(ClassResolver.java:938) at org.apache.fury.builder.JITContext.lambda$registerSerializerJITCallback$0(JITContext.java:94) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) Exception in thread "fury-jit-compiler-2" java.lang.IllegalAccessError: failed to access class org.wicketstuff.datastores.common.SessionQuotaManagingDataStore$DelegatedPage from class org.wicketstuff.datastores.common.SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0 (org.wicketstuff.datastores.common.SessionQuotaManagingDataStore$DelegatedPage is in unnamed module of loader 'app'; org.wicketstuff.datastores.common.SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0 is in unnamed module of loader org.apache.fury.util.ClassLoaderUtils$ByteArrayClassLoader @31123c7a) at org.wicketstuff.datastores.common.SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0.<init>(SessionQuotaManagingDataStore_SizeLimitedDataFuryRefCodec_0.java:59) at org.apache.fury.serializer.Serializers.createSerializer(Serializers.java:129) at org.apache.fury.serializer.Serializers.newSerializer(Serializers.java:104) at org.apache.fury.resolver.ClassResolver$1.onSuccess(ClassResolver.java:941) at org.apache.fury.resolver.ClassResolver$1.onSuccess(ClassResolver.java:938) at org.apache.fury.builder.JITContext.lambda$registerSerializerJITCallback$0(JITContext.java:94) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) ``` ### Anything Else? _No response_ ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- 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]
