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

In asyncCompilation to true, under the condition of it. The "it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap" serialization failure #1615

Closed
1 of 2 tasks
foxmia opened this issue May 9, 2024 · 2 comments · Fixed by #1618
Labels
bug Something isn't working

Comments

@foxmia
Copy link

foxmia commented May 9, 2024

Search before asking

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

Version

0.5.0、0.4.1

Component(s)

Java

Minimal reproduce step

Serialization fails only if asyncCompilation is true, there is no problem if asyncCompilation is false

@Data
public class Object2ObjectOpenHashMapTest {
    Map<String, String> ext = new Object2ObjectOpenHashMap<>();
}
ThreadSafeFury fury = Fury.builder()
        .requireClassRegistration(false)
        .withCompatibleMode(CompatibleMode.COMPATIBLE)
        .withAsyncCompilation(true)
        .buildThreadSafeFury();

Object2ObjectOpenHashMapTest object2ObjectOpenHashMapTest = new Object2ObjectOpenHashMapTest();
byte[] bytes = fury.serializeJavaObject(object2ObjectOpenHashMapTest);

The error message is as follows

Exception in thread "main" java.lang.ClassCastException: class org.apache.fury.serializer.collection.MapSerializers$JDKCompatibleMapSerializer cannot be cast to class org.apache.fury.serializer.collection.MapSerializer (org.apache.fury.serializer.collection.MapSerializers$JDKCompatibleMapSerializer and org.apache.fury.serializer.collection.MapSerializer are in unnamed module of loader 'app')
	at org.apache.fury.serializer.CompatibleSerializer.writeMapKVFinal(CompatibleSerializer.java:258)
	at org.apache.fury.serializer.CompatibleSerializer.writeSeparateFieldValue(CompatibleSerializer.java:226)
	at org.apache.fury.serializer.CompatibleSerializer.readAndWriteFieldValue(CompatibleSerializer.java:155)
	at org.apache.fury.serializer.CompatibleSerializer.write(CompatibleSerializer.java:110)
	at org.apache.fury.Fury.writeData(Fury.java:550)
	at org.apache.fury.Fury.serializeJavaObject(Fury.java:1050)
	at org.apache.fury.Fury.serializeJavaObject(Fury.java:1025)
	at org.apache.fury.ThreadLocalFury.serializeJavaObject(ThreadLocalFury.java:180)

What did you expect to see?

expect it to work.

What did you see instead?

class org.apache.fury.serializer.collection.MapSerializers$JDKCompatibleMapSerializer cannot be cast to class org.apache.fury.serializer.collection.MapSerializer (org.apache.fury.serializer.collection.MapSerializers$JDKCompatibleMapSerializer and org.apache.fury.serializer.collection.MapSerializer are in unnamed module of loader 'app')

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@foxmia foxmia added the bug Something isn't working label May 9, 2024
@chaokunyang
Copy link
Collaborator

Hi @foxmia could you provide code for Object2ObjectOpenHashMap?

@foxmia
Copy link
Author

foxmia commented May 9, 2024

Hi @foxmia could you provide code for Object2ObjectOpenHashMap?

This is dependency

<dependency>
    <groupId>it.unimi.dsi</groupId>
    <artifactId>fastutil</artifactId>
    <version>8.5.6</version>
</dependency>

chaokunyang added a commit that referenced this issue May 9, 2024
## What does this PR do?

fix fastutil Object2ObjectOpenHashMap serialization

## Related issues

Closes #1615 


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

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/incubator-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.

2 participants