arthas watch命令 :入参和监听到的结果有ArrayList 报StackOverflowError

nkkqxpd9  于 2021-11-28  发布在  Java
关注(0)|答案(9)|浏览(619)

ts=2021-08-31 00:32:18; [cost=251.935775ms] result=ERROR DATA!!! object class: class java.util.ArrayList, exception class: class java.lang.StackOverflowError, exception message: null

已经开启json返回格式:options json-format true
不开启,-x 20 的情况都不会出现此问题

tjrkku2a

tjrkku2a1#

有没有可能对象里面循环引用导致的,对象a里有对象b,对象b里面又有对象a

7fhtutme

7fhtutme2#

检查下list里的对象,可能这些对象�本身转换为json就会StackOverflowError

klsxnrf1

klsxnrf13#

这个检查过了,用fastjson是不会出现这个问题的,并且不仅仅是一个接口有这种情况,我用到的所有的涉及到list的都会报这个错误

gudnpqoy

gudnpqoy4#

检查过了,是没有的

olqngx59

olqngx595#

检查 ~/logs/arthas/arthas.log

gz5pxeao

gz5pxeao6#

看了下日志是栈溢出:我尝试debug然后用json打印一下看看,然后你们用的json版本是哪个?我用你们的版本试试
2021-08-31 00:53:12 [catalina-exec-40] ERROR c.taobao.arthas.core.view.ObjectView -ObjectView draw error, object class: class java.util.ArrayList
java.lang.StackOverflowError: null
at com.alibaba.fastjson.serializer.SerializeWriter.writeStringWithDoubleQuote(SerializeWriter.java:832)
at com.alibaba.fastjson.serializer.SerializeWriter.writeString(SerializeWriter.java:2185)
at com.alibaba.fastjson.serializer.MiscCodec.write(MiscCodec.java:166)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
at com.alibaba.fastjson.serializer.ListSerializer.write(ListSerializer.java:135)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(FieldSerializer.java:318)
at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:470)
...

jfewjypa

jfewjypa7#

https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md#%E5%BC%80%E5%8F%91%E8%80%85%E7%9B%B8%E5%85%B3

hmtdttj4

hmtdttj48#

我远程debug然后获取入参数中的list参数,使用JSON.toJSONString() 方法进行序列化是成功的。

arthas中使用的toJSONString传入的对象是JSON ,前面应该是还包了其他对象吧,需要怎么排查呢?
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:687)
at com.alibaba.fastjson.JSON.toJSONString(JSON.java:676)
at com.taobao.arthas.core.view.ObjectView.draw(ObjectView.java:45)

lkaoscv7

lkaoscv79#

watch命令默认打印的是{params, target, returnObj}, 可以测试下不同的参数。

相关问题