Online trouble-shooting with Arthas (1)

Online trouble-shooting with Arthas (1)

Arthas from Alibaba, is an online trouble-shooting tool.

No JVM restart, no additional code changes. Arthas works as an observer, that is, it will never suspend your running threads.

Launching Arthas:

$ java -jar arthas-boot.jar

Then select the application to be monitored.

Stop Arthas:

$ quit


$ exit

Basic Commands:

  1. dashboard command
$ dashboard

The dashboard command allows you to view the real-time data panel of the current system.

  1. thread command
$ thread 1

The thread 1 command prints the stack of thread ID 1.

Arthas supports pipes, and you can find main class with thread 1 | grep 'main('.

  1. sc command
$ sc -d *MathGame

The sc command can be used to find the loaded classes in the JVM

  1. jad command
$ jad demo.MathGame

The jad command can be used to decompile the byte code

  1. watch command
$ watch demo.MathGame primeFactors returnObj

The watch command can view the parameter/return value/exception of the method.

params refers to parameters

-x 2 means the print depth is 2