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

java.lang.IndexOutOfBoundsException: No enough data in the stream java.io.ByteArrayInputStream@36f0f1be #1757

Closed
1 of 2 tasks
zhangchaoxiang opened this issue Jul 24, 2024 · 3 comments · Fixed by #1758
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.6.0

Component(s)

Java

Minimal reproduce step

    ThreadSafeFury fury = Fury.builder().requireClassRegistration(false).withCompatibleMode(CompatibleMode.COMPATIBLE).buildThreadSafeFury();
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    fury.serialize(bas, Lists.newArrayList(1, 2, 3));
    fury.serialize(bas,Lists.newArrayList(10,9,7));
    fury.serialize(bas,Lists.newArrayList(7,5,4));
    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?

java.lang.IndexOutOfBoundsException: No enough data in the stream java.io.ByteArrayInputStream@36f0f1be

at org.apache.fury.io.FuryInputStream.fillBuffer(FuryInputStream.java:66)
at org.apache.fury.memory.MemoryBuffer.readerIndex(MemoryBuffer.java:1274)
at org.apache.fury.resolver.ClassResolver.readClassDefs(ClassResolver.java:1469)
at org.apache.fury.Fury.deserialize(Fury.java:758)
at org.apache.fury.Fury.deserialize(Fury.java:780)
at org.apache.fury.Fury.deserialize(Fury.java:773)
at org.apache.fury.ThreadLocalFury.deserialize(ThreadLocalFury.java:160)

Anything Else?

In version 0.5.1 it ran successfully, but after upgrading to 0.6.0 an exception was thrown, which is related to enabling COMPATIBLE.

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 24, 2024
@chaokunyang
Copy link
Collaborator

We enabled scoped meta share mode by default, but it doesn't support native streaming deserializaiton. Could you use org.apache.fury.io.BlockedStreamUtils instead?

@zhangchaoxiang
Copy link
Author

I have checked the BlockedStreamUtils method. The deserialization process reads the entire byte stream before performing the actual deserialization. However, my file is large and requires streaming reads. It's not feasible to read the entire byte stream into memory.
Is there any other solution available?

@chaokunyang
Copy link
Collaborator

Could you disable scopedMetaShare option? I tested locally, It works

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.

2 participants