Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using buildThreadSafeFuryPool(10, 60) for init ThreadSafePool, the following exception occurs: #1959

Open
1 of 2 tasks
Moouna opened this issue Nov 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Moouna
Copy link

Moouna commented Nov 27, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

0.9.0

Component(s)

Java

Minimal reproduce step

This issue does not occur when using buildThreadSafeFury().


Code to Reproduce

@Data
public static class Outer {
    private String code;
    private List<Inner> innerList;
}

@Data
public static class Inner {
    private String name;
}

@Test
public void threadSafeTest() {
    MetaContext context = new MetaContext();

    ThreadSafeFury fury = Fury.builder()
            .withLanguage(Language.JAVA)
            .withMetaShare(true)
            .withRefCopy(false)
            .withCodegen(true)
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .withScopedMetaShare(false)
            .withJdkClassSerializableCheck(false)
            .requireClassRegistration(true)
            // Uncommenting the following line causes the issue
            //.buildThreadSafeFuryPool(10,60);
            .buildThreadSafeFury();

    fury.register(Outer.class);
    fury.register(Inner.class);

    Outer bean = new Outer();
    bean.setCode("test");
    bean.setInnerList(new ArrayList<>());

    for (int i = 0; i < 10000; i++) {
        byte[] bytes = fury.execute(f -> {
            f.getSerializationContext().setMetaContext(context);
            return f.serialize(bean);
        });
        Outer des = (Outer) fury.execute(f -> {
            f.getSerializationContext().setMetaContext(context);
            return f.deserialize(bytes);
        });
        Assertions.assertEquals(bean, des);
    }
}

What did you expect to see?

test success

What did you see instead?

java.lang.AssertionError:  Meta context must be set before serialization, please set meta context by SerializationContext.setMetaContext

	at org.apache.fury.resolver.ClassResolver.readClassInfoWithMetaShare(ClassResolver.java:1385)
	at org.apache.fury.resolver.ClassResolver.readClassInfo(ClassResolver.java:1693)
	at com.zhaopin.entinfo.router.test.MetaContextTest_OuterFuryCodecMetaShared0_0.readFields$(MetaContextTest_OuterFuryCodecMetaShared0_0.java:64)
	at com.zhaopin.entinfo.router.test.MetaContextTest_OuterFuryCodecMetaShared0_0.read(MetaContextTest_OuterFuryCodecMetaShared0_0.java:118)
	at org.apache.fury.Fury.readDataInternal(Fury.java:959)
	at org.apache.fury.Fury.readRef(Fury.java:861)
	at org.apache.fury.Fury.deserialize(Fury.java:793)
	at org.apache.fury.Fury.deserialize(Fury.java:714)
        at test.MetaContextTest.lambda$threadSafeTest$2(MetaContextTest.java:78)
	at org.apache.fury.pool.ThreadPoolFury.execute(ThreadPoolFury.java:82)
	at com.zhaopin.entinfo.router.test.MetaContextTest.threadSafeTest(MetaContextTest.java:76)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:532)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:171)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:167)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:114)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:59)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:108)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$4(NodeTestTask.java:112)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:72)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:98)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:74)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@Moouna Moouna added the bug Something isn't working label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant