alibaba / arthas

Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas
https://arthas.aliyun.com/
Apache License 2.0
35.07k stars 7.38k forks source link

使用trace命令报错,No class or method is affected #311

Closed GavinTianYang closed 5 years ago

GavinTianYang commented 5 years ago

$ sm xxx.xxx.xxxFacade add Affect(row-cnt:1) cost in 16 ms.

$ trace xxx.xxx.xxxFacade add No class or method is affected, try:

  1. sm CLASS_NAME METHOD_NAME to make sure the method you are tracing actually exists (it might be in your parent class).
  2. reset CLASS_NAME and try again, your method body might be too large.
  3. visit middleware-container/arthas/issues/278 for more detail

同一个方法,sm可以得到结果,trace、monitor、watch都获得上诉异常。 对于一些类会出现这个状况,一些类却能正常工作。

环境:

  1. jdk-10.0.2
  2. arthas 3.0.2
  3. linux
hengyunabc commented 5 years ago

参考: https://github.com/alibaba/arthas/issues/198

GavinTianYang commented 5 years ago

参考: #198

多谢你的回复,但是我参考了#198,但仍然没有解决我的问题。 操作记录如下

$ sm imserver.chat.controller.MessageController 
imserver.chat.controller.MessageController-><init>
imserver.chat.controller.MessageController->confirm
imserver.chat.controller.MessageController->send
imserver.chat.controller.MessageController->deleteMessage
imserver.chat.controller.MessageController->list
Affect(row-cnt:5) cost in 19 ms.
$ trace imserver.chat.controller.MessageController send
No class or method is affected, try:
1.sm CLASS_NAME METHOD_NAME to make sure the method you are tracing actually exists (it might be in your parent class).
2.reset CLASS_NAME and try again, your method body might be too large.
3.visit middleware-container/arthas/issues/278 for more detail 
$ reset imserver.chat.controller.MessageController 
Affect(class-cnt:0 , method-cnt:0) cost in 0 ms.

arthas.log日志文件如下,似乎并没有异常信息:

[as-command-execute-daemon:arthas] [] [] [] Success to batch transform classes:
 [class imserver.chat.controller.MessageController]

通过sm可以输出class信息,所以可以确定pid无误,也不是系统级别的类。我感觉很困惑

hengyunabc commented 5 years ago

最好提供可重现的 Demo

GavinTianYang commented 5 years ago

最好提供可重现的 Demo

发现问题是因为我的代码编译级别是10,换到9或9以下就没有这个问题了

GavinTianYang commented 5 years ago

最好提供可重现的 Demo

szlzhm commented 5 years ago

我这里也遇到这样的问题,我的java编译用java1.8.0_161,运行环境是java1.8.0_181,ubuntu 16.0 64位,springboot应用。下面是命令好相关故障: 命令:trace com.kc.Compare compare 故障输出: Press Ctrl+c to abort Affect(class-cnt:1, method-cnt:1) cost in 183 ms.

然后就没有输出了。 我这个命令本来是有输出的,运行了多次后,就不论怎样都没有输出了。

pluto-tu commented 1 year ago

我这里也遇到这样的问题,我的java编译用java1.8.0_161,运行环境是java1.8.0_181,ubuntu 16.0 64位,springboot应用。下面是命令好相关故障: 命令:trace com.kc.Compare compare 故障输出: Press Ctrl+c to abort Affect(class-cnt:1, method-cnt:1) cost in 183 ms.

然后就没有输出了。 我这个命令本来是有输出的,运行了多次后,就不论怎样都没有输出了。

因为你没有发送这个请求 请求一次 就会有trace打印出来了