You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello
I'm just investigating alternativs for java serialization. We are using
SpringHTTPInvoker to transmit objects. After it seems everything should run
now. I run into a Stackoverflow during serialisation. We have a quite
complex entity-structure where it is possible to navigate forth and back
through the object tree. When I look at the stacktrace I would say the
repeating fieldtypes are the problem.
java.lang.StackOverflowError
at java.lang.reflect.AccessibleObject.<init>(AccessibleObject.java:137)
at java.lang.reflect.Field.<init>(Field.java:104)
at java.lang.reflect.Field.copy(Field.java:127)
at java.lang.reflect.ReflectAccess.copyField(ReflectAccess.java:122)
at sun.reflect.ReflectionFactory.copyField(ReflectionFactory.java:289)
at java.lang.Class.copyFields(Class.java:2739)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.rebuildCachedFields(FieldSer
ializer.java:65)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.<init>(FieldSerializer.java:
52)
at com.esotericsoftware.kryo.Kryo.getDefaultSerializer(Kryo.java:224)
at com.esotericsoftware.kryo.Kryo.getRegisteredClass(Kryo.java:240)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.rebuildCachedFields(FieldSer
ializer.java:100)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.<init>(FieldSerializer.java:
52)
at com.esotericsoftware.kryo.Kryo.getDefaultSerializer(Kryo.java:224)
at com.esotericsoftware.kryo.Kryo.getRegisteredClass(Kryo.java:240)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.rebuildCachedFields(FieldSer
ializer.java:100)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.<init>(FieldSerializer.java:
52)
at com.esotericsoftware.kryo.Kryo.getDefaultSerializer(Kryo.java:224)
at com.esotericsoftware.kryo.Kryo.getRegisteredClass(Kryo.java:240)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.rebuildCachedFields(FieldSer
ializer.java:100)
at
com.esotericsoftware.kryo.serialize.FieldSerializer.<init>(FieldSerializer.java:
52)
at com.esotericsoftware.kryo.Kryo.getDefaultSerializer(Kryo.java:224)
at com.esotericsoftware.kryo.Kryo.getRegisteredClass(Kryo.java:240)
<snip>
I'm wondering if kryo would have the same problem with repeated objects and
circular references.
Maybee an IdentiyHashMap would solve this during processing the fields.
Cheers
Marco
What version of the product are you using? On what operating system?
Windows Kryo 0.99
Please provide any additional information below.
Original issue reported on code.google.com by m.br...@gmx.de on 1 Mar 2010 at 8:08
The text was updated successfully, but these errors were encountered:
Hi Marco,
FieldSerializer is the default serializer used for most objects (see
Kryo#register(Class) and Kryo#getDefaultSerializer(Class)). It does not support
object references. Any objects in the graph more than once will be serialized
individually more than once. Circular references will cause a stack overflow.
If you would like to serialize object references in your object graph, register
your
classes using ReferenceFieldSerializer. Please see the javadocs for that class
for
notes about the additional overhead it introduces. You may override
Kryo#getDefaultSerializer(Class) as an easy way to use ReferenceFieldSerializer
for
all your classes without having to construct and pass in a new
ReferenceFieldSerializer each time you call Kryo#register.
You may be interested in the discussion thread that caused
ReferenceFieldSerializer
to be added to Kryo. The thread is on the discussion forum for KryoNet, a sister
project that does NIO-based TCP and UDP network communication:
http://groups.google.com/group/kryonet-users/browse_thread/thread/84235dbe943ada
71#e08daae3f56e2785
Original comment by nathan.s...@gmail.com on 1 Mar 2010 at 8:26
Original issue reported on code.google.com by
m.br...@gmx.de
on 1 Mar 2010 at 8:08The text was updated successfully, but these errors were encountered: