[英]Akka - StackOverflowError during object serialization
I'm with a problem that extends for more than 2 days. 我遇到的问题持续了超过2天。 When I'm exchanging messages between actors, is accusing the JVM stack overflow.
当我在参与者之间交换消息时,是在指责JVM堆栈溢出。
My message is an object with many links (10000+ child objects linked together in a linked list). 我的消息是一个具有许多链接的对象(10000个子对象在链接列表中链接在一起)。 Namely, an object with Neo4J relationships.
即,具有Neo4J关系的对象。
The error is this: 错误是这样的:
java.lang.StackOverflowError
at java.io.Bits.putLong(Bits.java:108)
at java.io.ObjectOutputStream$BlockDataOutputStream.writeLong(ObjectOutputStream.java:1928)
at java.io.ObjectOutputStream.writeLong(ObjectOutputStream.java:788)
at java.util.Date.writeObject(Date.java:1303)
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
Does anyone have any solution for this? 有人对此有任何解决方案吗?
thanks 谢谢
Are you using java.util.LinkedList
, or a custom linked list of your own? 您使用的是
java.util.LinkedList
还是您自己的自定义链接列表? If the latter, you need to write a custom writeObject()
method for it that avoids the recursion that would happen if you didn't have one. 如果是后者,则需要为其编写一个自定义的
writeObject()
方法,该方法避免了如果没有递归时将发生的递归。
The likely candidate for the problem is an object which has a reference to itself. 该问题的可能候选者是具有自身参考的对象。 Given your expression of the domain I suspect a child has a linked list which includes itself, or a cyclic reference.
给定您对域的表达,我怀疑孩子有一个包含其自身的链接列表或循环引用。 That is, one of the nodes it is linked to has a link to it in turn.
也就是说,它链接到的节点之一又有一个链接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.