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

org.apache.fury.exception.DeserializationException: Deserialize failed, read objects are: [null] #1759

Closed
1 of 2 tasks
zhangchaoxiang opened this issue Jul 25, 2024 · 0 comments · Fixed by #1760
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@zhangchaoxiang
Copy link

Search before asking

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

Version

0.7.0-SNAPSHOT

Component(s)

Java

Minimal reproduce step

@Test
public void test() throws IOException {
    ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
            //开启共享引用/循环引用支持
            .withRefTracking(true)
            .requireClassRegistration(false)
            //开启异步多线程编译
            .withStringCompressed(true)
            .withNumberCompressed(false)
            //开启类型前后兼容
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .buildThreadSafeFury();
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    List list = new ArrayList<>();
    HashMap<String, String> map = new HashMap<>();
    for (int i = 0; i < 500000; i++) {
        list.add(i);
        map.put("key" + i, "value" + i);
    }
    fury.serialize(bas, list);
    fury.serialize(bas, map);
    fury.serialize(bas, list);
    bas.flush();

    InputStream bis = new ByteArrayInputStream(bas.toByteArray());
    FuryInputStream stream = of(bis);
    Object lobj1 = fury.deserialize(stream);
    Object lobj2 = fury.deserialize(stream);
    Object lobj3 = fury.deserialize(stream);
}

@Test
public void test1() throws IOException {
    ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
            //开启共享引用/循环引用支持
            .withRefTracking(true)
            .requireClassRegistration(false)
            //开启异步多线程编译
            .withStringCompressed(true)
            .withNumberCompressed(false)
            //开启类型前后兼容
            .withCompatibleMode(CompatibleMode.COMPATIBLE)
            .buildThreadSafeFury();
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    fury.serialize(bas, new HashMap[5000000]);
    fury.serialize(bas, new long[5000000]);
    fury.serialize(bas, new int[5000000]);
    bas.flush();

    InputStream bis = new ByteArrayInputStream(bas.toByteArray());
    FuryInputStream stream = of(bis);
    Object lobj1 = fury.deserialize(stream);
    Object lobj2 = fury.deserialize(stream);
    Object lobj3 = fury.deserialize(stream);
}

What did you expect to see?

no exception

What did you see instead?

org.apache.fury.exception.DeserializationException: Deserialize failed, read objects are: [null]
at org.apache.fury.util.ExceptionUtils.handleReadFailed(ExceptionUtils.java:63)
at org.apache.fury.Fury.deserialize(Fury.java:793)
at org.apache.fury.Fury.deserialize(Fury.java:812)
at org.apache.fury.Fury.deserialize(Fury.java:805)
at org.apache.fury.ThreadLocalFury.deserialize(ThreadLocalFury.java:160)
at me.ele.roadnet.algo.odps.cli.FuryTest.test1(FuryTest.java:82)
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.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
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:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.NullPointerException
at org.apache.fury.resolver.ClassResolver.getOrUpdateClassInfo(ClassResolver.java:1153)
at org.apache.fury.resolver.ClassResolver.readClassInfoWithMetaShare(ClassResolver.java:1345)
at org.apache.fury.resolver.ClassResolver.readClassInfo(ClassResolver.java:1603)
at org.apache.fury.Fury.readRef(Fury.java:857)
at org.apache.fury.Fury.deserialize(Fury.java:789)
... 31 more

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@zhangchaoxiang zhangchaoxiang added the bug Something isn't working label Jul 25, 2024
chaokunyang added a commit that referenced this issue Jul 25, 2024
## What does this PR do?

 fix big buffer streaming MetaShared read by using relative offset

## Related issues

Closes #1759 

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fury/issues/new/choose) describing the
need to do so and update the document if necessary.
-->

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


## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.
-->
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

Successfully merging a pull request may close this issue.

1 participant