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

deserialize fails with java.lang.NullPointerException #1455

Open
1 of 2 tasks
andyczerwonka opened this issue Apr 2, 2024 · 5 comments
Open
1 of 2 tasks

deserialize fails with java.lang.NullPointerException #1455

andyczerwonka opened this issue Apr 2, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@andyczerwonka
Copy link

Search before asking

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

Version

0.5.0-rc2

Component(s)

Java

Minimal reproduce step

We are attempting to replace the latest snapshot with rc2, and we're getting the following exception

org.apache.fury.exception.DeserializationException: Deserialize failed, read objects are: [<clipped stringified model>, null, scala.collection.generic.DefaultSerializationProxy@5d2828c9, scala.collection.IterableFactory$ToFactory@3a082ff4, null]
	at org.apache.fury.Fury.handleReadFailed(Fury.java:784)
	at org.apache.fury.Fury.deserialize(Fury.java:755)
	at org.apache.fury.Fury.deserialize(Fury.java:685)
	at org.apache.fury.ThreadLocalFury.deserialize(ThreadLocalFury.java:99)
	at io.citrine.mithril.modules.predictors.Predictor$.$anonfun$decode$1(Predictor.scala:111)
	at scala.util.Try$.apply(Try.scala:210)
	at io.citrine.mithril.modules.predictors.Predictor$.decode(Predictor.scala:107)
	at io.citrine.mithrilworkbench.Main$.$anonfun$tryToDecodeThisPredictor$1(Main.scala:334)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scribe.LoggerSupport.elapsed(LoggerSupport.scala:67)
	at scribe.LoggerSupport.elapsed$(LoggerSupport.scala:62)
	at scribe.package$.elapsed(package.scala:8)
	at io.citrine.mithrilworkbench.Main$.tryToDecodeThisPredictor(Main.scala:323)
	at io.citrine.mithrilworkbench.Main$.$anonfun$main$5(Main.scala:351)
	at io.citrine.mithrilworkbench.Main$.$anonfun$main$5$adapted(Main.scala:351)
	at mainargs.Invoker$.$anonfun$invoke0$3(Invoker.scala:63)
	at mainargs.Result.flatMap(Result.scala:13)
	at mainargs.Result.flatMap$(Result.scala:12)
	at mainargs.Result$Success.flatMap(Result.scala:23)
	at mainargs.Invoker$.invoke0(Invoker.scala:62)
	at mainargs.Invoker$.invoke(Invoker.scala:72)
	at mainargs.Invoker$.$anonfun$runMains$1(Invoker.scala:92)
	at mainargs.Result.flatMap(Result.scala:13)
	at mainargs.Result.flatMap$(Result.scala:12)
	at mainargs.Result$Success.flatMap(Result.scala:23)
	at mainargs.Invoker$.groupArgs$1(Invoker.scala:92)
	at mainargs.Invoker$.runMains(Invoker.scala:107)
	at mainargs.ParserForMethods.runRaw0(Parser.scala:170)
	at mainargs.ParserForMethods.runEither(Parser.scala:108)
	at mainargs.ParserForMethods.runEither(Parser.scala:151)
	at mainargs.ParserForMethods.runOrExit(Parser.scala:56)
	at io.citrine.mithrilworkbench.Main$.main(Main.scala:352)
	at io.citrine.mithrilworkbench.Main.main(Main.scala)
Caused by: java.lang.NullPointerException
	at scala.collection.IterableFactory$ToFactory.newBuilder(Factory.scala:275)
	at scala.collection.generic.DefaultSerializationProxy.readObject(DefaultSerializationProxy.scala:48)
	at org.apache.fury.serializer.ObjectStreamSerializer.read(ObjectStreamSerializer.java:221)
	at org.apache.fury.serializer.ReplaceResolveSerializer.readObject(ReplaceResolveSerializer.java:316)
	at org.apache.fury.serializer.ReplaceResolveSerializer.read(ReplaceResolveSerializer.java:305)
	at org.apache.fury.Fury.readData(Fury.java:884)
	at org.apache.fury.serializer.ReplaceResolveSerializer.read(ReplaceResolveSerializer.java:284)
	at org.apache.fury.serializer.collection.CollectionSerializers$JDKCompatibleCollectionSerializer.read(CollectionSerializers.java:574)
	at org.apache.fury.Fury.readDataInternal(Fury.java:916)
	at org.apache.fury.Fury.readRef(Fury.java:831)
	at org.apache.fury.serializer.ObjectSerializer.readOtherFieldValue(ObjectSerializer.java:438)
	at org.apache.fury.serializer.ObjectSerializer.readAndSetFields(ObjectSerializer.java:382)
	at org.apache.fury.serializer.ObjectSerializer.read(ObjectSerializer.java:316)
	at org.apache.fury.Fury.readDataInternal(Fury.java:916)
	at org.apache.fury.Fury.readRef(Fury.java:831)
	at org.apache.fury.serializer.ObjectSerializer.readOtherFieldValue(ObjectSerializer.java:438)
	at org.apache.fury.serializer.ObjectSerializer.readAndSetFields(ObjectSerializer.java:382)
	at org.apache.fury.serializer.ObjectSerializer.read(ObjectSerializer.java:316)
	at org.apache.fury.Fury.readDataInternal(Fury.java:916)
	at org.apache.fury.Fury.readRef(Fury.java:818)
	at org.apache.fury.serializer.ObjectStreamSerializer$FuryObjectInputStream.readObjectOverride(ObjectStreamSerializer.java:693)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:480)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:447)
	at scala.collection.generic.DefaultSerializationProxy.readObject(DefaultSerializationProxy.scala:54)
	at org.apache.fury.serializer.ObjectStreamSerializer.read(ObjectStreamSerializer.java:221)
	at org.apache.fury.serializer.ReplaceResolveSerializer.readObject(ReplaceResolveSerializer.java:316)
	at org.apache.fury.serializer.ReplaceResolveSerializer.read(ReplaceResolveSerializer.java:305)
	at org.apache.fury.Fury.readData(Fury.java:884)
	at org.apache.fury.serializer.ReplaceResolveSerializer.read(ReplaceResolveSerializer.java:284)
	at org.apache.fury.serializer.collection.CollectionSerializers$JDKCompatibleCollectionSerializer.read(CollectionSerializers.java:574)
	at org.apache.fury.Fury.readDataInternal(Fury.java:916)
	at org.apache.fury.Fury.readRef(Fury.java:831)
	at org.apache.fury.serializer.ObjectSerializer.readOtherFieldValue(ObjectSerializer.java:438)
	at org.apache.fury.serializer.ObjectSerializer.readAndSetFields(ObjectSerializer.java:382)
	at org.apache.fury.serializer.ObjectSerializer.read(ObjectSerializer.java:316)
	at org.apache.fury.Fury.readDataInternal(Fury.java:916)
	at org.apache.fury.Fury.readRef(Fury.java:818)
	at org.apache.fury.Fury.deserialize(Fury.java:751)

What did you expect to see?

We expect it to work.

What did you see instead?

Caused by: java.lang.NullPointerException
	at scala.collection.IterableFactory$ToFactory.newBuilder(Factory.scala:275)
	at scala.collection.generic.DefaultSerializationProxy.readObject(DefaultSerializationProxy.scala:48)

Anything Else?

No response

Are you willing to submit a PR?

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

chaokunyang commented Apr 3, 2024

Hi @andyczerwonka , could you provide reproduction code here? I'll debug into your code to find out what happened

@andyczerwonka
Copy link
Author

Hi @andyczerwonka , could you provide reproduction code here? I'll debug into your code to find out what happened

Unfortunately we're in the same situation as we are here.

@LiangliangSui
Copy link
Contributor

Can we improve the log system and insert some info and debug logs into the code? For this situation where reproducible code cannot be provided but is reproducible stably, users can dynamically configure the log level through ENV, and then upload the collected log, we can restore the problem through these logs.

But I'm also worried that too many insert points in the code will cause performance degradation.

WDYT? @chaokunyang

@chaokunyang
Copy link
Collaborator

Can we improve the log system and insert some info and debug logs into the code? For this situation where reproducible code cannot be provided but is reproducible stably, users can dynamically configure the log level through ENV, and then upload the collected log, we can restore the problem through these logs.

But I'm also worried that too many insert points in the code will cause performance degradation.

WDYT? @chaokunyang

The log will be in critical path. If the error happens occasionally, the users may won't enable such log level.

If the error happens frequently, we may not need the log to restore the error

@chaokunyang
Copy link
Collaborator

Hi @andyczerwonka , could you reproduce this error locally now?

chaokunyang added a commit that referenced this issue May 6, 2024
## What does this PR do?
Some collectionSerializer may overwrite write/read method, then clear
element serializer may not got invoked.

This PR clears serializer for collection/map to avoid container use
wrong serializer for nested elements.

## Related issues

#1558
#1455,
#1325 and
#1176.

## 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

No branches or pull requests

3 participants