com.esotericsoftware.kryo.KryoException: Unable to find class: ocation

1,604 views
Skip to first unread message

Mark Polak

unread,
Feb 27, 2017, 5:33:34 AM2/27/17
to kryo-users
Hello,

I am using Kryo 3.0.0.

Occasionally (once every thousands-millions of calls to serialize/deserialize but with not apparent pattern), I am encountering the exception below.

I don't have the exact scenario, but I have done some digging/debugging.

It occurs when I am trying to serialize a HashMap<String, String> with 5 values. This HashMap is not an object field, but is being serialized by itself. Nevertheless, when the issue occurs, I see in the debugger that the generics fields are set on the MapSerialzier, which causes the class information not to be written during serialization. As a result, during deserialziation kryo thinks the first key in the map ("Location") is the class of the key, which causes the exception below.

I am using KryoPool, so it is probably not a multi-threading issue. Also, if it was a multi-threading issue, I'd expect to see different errors each time, and that is the only error I experience, even though kryo is used heavily in multiple components in the application.

I thought that perhaps somehow a MapSerializer instance becomes dirty with generics info which isn't being cleared (in my scenario/flow multiple objects are being serialized and deserialized by this kryo instance before the issue occurs), but looking at the code I couldn't find a scenario which leads to this behaviour.

I'd greatly appreciate some help (so far I've already invested a few days of work into this research). I have also looked a bit in any potential changes in the code up until Kryo 4, and none seems to address this issue.

Exception:
Caused by: com.esotericsoftware.kryo.KryoException: Unable to find class: ocation
at com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:138)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:115)
at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:666)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:777)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:135)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:21)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:786)
at com.aeroscout.mobileview.common.util.SerializationUtils.deserializeObject(SerializationUtils.java:82)
... 15 more
Caused by: java.lang.ClassNotFoundException: ocation
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readName(DefaultClassResolver.java:136)
... 22 more

Thanks,
Mark

Martin Grotzke

unread,
Feb 27, 2017, 4:34:24 PM2/27/17
to kryo-users

Hi Mark,

can you try to make this reproducable in a self contained test case, e.g. doing thousands-millions roundtrips, and perhaps "simulating" concurrency?

Can you please submit an issue for this?

Thanks && cheers,
Martin


--
You received this message because you are subscribed to the "kryo-users" group.
http://groups.google.com/group/kryo-users
---
You received this message because you are subscribed to the Google Groups "kryo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kryo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages