【Arthas使用trace命令报错error happens when enhancing class: Method too large】

arthasArthas使用trace命令报错error happens when enhancing class: Method too large

  1. 问题描述。
    在线上有一个接口存在超时问题,方法大概有400行,使用arthas的trace命令,统计该方法的耗时
trace xxxx.xxxx.xxxx.service.impl.xxxxxxExcelServiceImpl getImportTemplate  -n 5 --skipJDKMethod false

执行命令之后,还未使用接口,出现以下报错
Affect(class count: 0 , method count: 1) cost in 4749 ms, listenerId: 1
Enhance error!exception:com.alibaba.deps.org.objectweb.asm.MethodTooLargeException: Method too large: xxxx.xxxx.xxxx.service.impl.xxxxxxExcelServiceImpl.getImportTemplate

2.解决方案
版本如下
jdk 1.8
arthas 3.7.1
解决办法:方法太长,大方法拆分成小方法。
我把400行的方法,拆出来200行,主方法只有200行,再trace 主方法,成功监控

3.思考
arthas应该是有限制方法大小,但是我在官方文档未找到类似的描述。虽然问题解决了,但Method too large问题的原因没有找到,请各位大佬评论区留言解惑

你可能感兴趣的:(arthas,java,开发语言)