Arthas has been open source since September and has been supported by many Java developers, with Github Star counting over 6000 in three months. Thank you very much for your support. Arthas received a number of suggestions from users, most notably:

  1. Windows platform user experience is poor
  2. The Attach process is inconsistent with the final Attach process
  3. Some environments do not have Telnet installed and cannot connect to Arthas Server
  4. Local boot, no need to download remote (many company security concerns)
  5. Slow download (default download from Maven Central Repository)

In Arthas version 3.0.5, we have made a number of improvements to the user experience, which are described below.

  • Documents: alibaba. Making. IO/arthas
  • Making: github.com/alibaba/art…
  • Gitee: gitee.com/arthas/arth…

Arthas-boot for all platforms

Arthas-boot is a new fully platform-enabled launcher for Windows, Mac, and Linux. After downloading, the direct java-jar command launches:

wget https://alibaba.github.io/arthas/arthas-boot.jar
java -jar arthas-boot.jar
Copy the code

Arthas-boot is more powerful than the previous As.sh.

  • For example, if the download speed is slow, you can specify the image of Ali Cloud.

    java -jar arthas-boot.jar --repo-mirror aliyun --use-http
    Copy the code
  • For example, you can use session-timeout to specify the timeout period:

    java -jar arthas-boot.jar --session-timeout 3600
    Copy the code
  • More features can be viewed with Java -jar arthas-boot.jar -h

Arthas-boot will start a Java Telent client to connect to arthas Server after attaching successfully, and users can use arthas without Telnet installed.

Preferentially use Arthas for the current directory

In the new version, arthas Home is looked up by default from the arthas-boot.jar and as.sh directories, so that users do not need to download Arthas remotely after a full installation.

  • Users can more easily integrate into their own base images, or docker images
  • Companies with strict security requirements don’t have to worry about remote downloads

Inspect ports before attaching

In previous versions, one of the biggest frustrations for users was selecting process A but actually connecting to process B.

The reason is that process B was attached before and shutdown was not executed. The next time it is executed, it is still connected to process B.

In the new version, improvements have been made:

  • Check for processes using port 3658 before attach
  • If the port and process do not match during Attach, an ERROR message is printed
$ java -jar arthas-boot.jar
[INFO] Process 1680 already using port 3658
[INFO] Process 1680 already using port 8563
* [1]: 1680 Demo
  [2]: 35542
  [3]: 82334 Demo
3
[ERROR] Target process 82334 is not the process using port 3658, you will connect to an unexpected process.
[ERROR] If you still want to attach target process 82334, Try to set a different telnet port by using --telnet-port argument.
[ERROR] Or try to shutdown the process 1680 using the telnet port first.
Copy the code

Better history command matching

  • The new version has a better matching mechanism for keyboard Up/Down

    For example, after executing trace for several times, you cannot remember the specific class name of the previous trace after entering trace on the command line. In this case, you can easily match the previous history command by pressing Up without turning pages.

  • The new version adds the history command

Improve the Web Console experience

  • Improved font support for Windows

    Previously, Windows used unequal width fonts, which looked uncomfortable. The new version is uniform for the same width font.

  • Enlarge the font, no longer hurt the eyes

The sysenv command was added

The sysenv command is similar to sysprop in that it prints environment variables for the JVM.

  • Alibaba. Making. IO/arthas/syse…

Added the ognl command

The ognl command enables you to execute the OGNL script separately. It’s easy to call all kinds of code.

For example, execute a multi-line expression, assign a value to a temporary variable, and return a List:

$ ognl '#value1=@System@getProperty("java.home"), #value2=@System@getProperty("java.runtime.name"), {#value1, #value2}'
@ArrayList[
    @String[/opt/java/8.0.181-zulu/jre],
    @String[OpenJDK Runtime Environment],
]
Copy the code
  • Alibaba. Making. IO/arthas/ognl…

The watch command takes time to print, which helps locate performance bottlenecks

Previously, the watch command only supports printing the return value of input parameters. The new version also prints the call time, which can easily locate performance bottlenecks.

$ watch demo.MathGame primeFactors 'params[0]'
Press Ctrl+C to abort.
Affect(class-cnt:1 , method-cnt:1) cost in22 ms. ts=2018-11-29 17:53:54; [cost] = 0.131383 ms result = @ Integer [387929024] ts = 2018-11-29 17:53:55; [cost] = 0.132368 ms result = @ Integer [1318275764] ts = 2018-11-29 17:53:56; [cost] = 0.496598 ms result = @ Integer [76446257] 17:53:57 ts = 2018-11-29; [cost] = 4.9617 ms result = @ Integer [1853966253]Copy the code
  • Alibaba. Making. IO/arthas/watc…

Improved class search and match functionality to better support lambdas and inner classes

In previous versions, it was possible to fail when searching for lambda classes or unmarshalled lambda classes. The new version has been fixed. Such as

$ jad Test? Lambda$1/1406718218

ClassLoader:
+-sun.misc.Launcher$AppClassLoader@5c647e05
  +-sun.misc.Launcher$ExtClassLoader@3c1491ce

Location:
/tmp/classes

/* * Decompiled with CFR 0_132. * * Could not load the following classes: * Test * Test? Lambda$1 */
import java.lang.invoke.LambdaForm;
import java.util.function.Consumer;

final class Test?LambdaThe $1implements Consumer {
    privateTest? Lambda$1() {}@LambdaForm.Hidden
    public void accept(Object object) {
        Test.lambda$0((Integer)((Integer)object)); }}Copy the code

Better TAB completion

Improved TAB auto-completion function for many commands. When there is a pause, you can press TAB to try again.

Release Note

Release Note: github.com/alibaba/art…