mirror of https://github.com/alibaba/arthas.git
Merge remote-tracking branch 'origin/master' into channel-server
commit
f01b41fdd5
@ -0,0 +1,34 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "arthas-all-*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [8]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup java
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Build with Maven
|
||||
run: mvn clean package -P full
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
packaging/target/*.zip
|
||||
packaging/target/*.deb
|
||||
packaging/target/*.rpm
|
||||
tunnel-server/target/*fatjar.jar
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,50 +0,0 @@
|
||||
package com.taobao.arthas.core.command.basic1000;
|
||||
|
||||
import com.alibaba.arthas.deps.org.slf4j.Logger;
|
||||
import com.alibaba.arthas.deps.org.slf4j.LoggerFactory;
|
||||
import com.taobao.arthas.core.command.model.MessageModel;
|
||||
import com.taobao.arthas.core.command.model.ResetModel;
|
||||
import com.taobao.arthas.core.command.model.ShutdownModel;
|
||||
import com.taobao.arthas.core.server.ArthasBootstrap;
|
||||
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
||||
import com.taobao.arthas.core.util.affect.EnhancerAffect;
|
||||
import com.taobao.middleware.cli.annotations.Hidden;
|
||||
import com.taobao.middleware.cli.annotations.Name;
|
||||
import com.taobao.middleware.cli.annotations.Summary;
|
||||
|
||||
/**
|
||||
* 关闭命令
|
||||
*
|
||||
* @author vlinux on 14/10/23.
|
||||
* @see StopCommand
|
||||
*/
|
||||
@Name("shutdown")
|
||||
@Summary("Shutdown Arthas server and exit the console")
|
||||
@Hidden
|
||||
public class ShutdownCommand extends AnnotatedCommand {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ShutdownCommand.class);
|
||||
|
||||
@Override
|
||||
public void process(CommandProcess process) {
|
||||
shutdown(process);
|
||||
}
|
||||
|
||||
public static void shutdown(CommandProcess process) {
|
||||
ArthasBootstrap arthasBootstrap = ArthasBootstrap.getInstance();
|
||||
try {
|
||||
// 退出之前需要重置所有的增强类
|
||||
process.appendResult(new MessageModel("Resetting all enhanced classes ..."));
|
||||
EnhancerAffect enhancerAffect = arthasBootstrap.reset();
|
||||
process.appendResult(new ResetModel(enhancerAffect));
|
||||
process.appendResult(new ShutdownModel(true, "Arthas Server is going to shut down..."));
|
||||
} catch (Throwable e) {
|
||||
logger.error("An error occurred when stopping arthas server.", e);
|
||||
process.appendResult(new ShutdownModel(false, "An error occurred when stopping arthas server."));
|
||||
} finally {
|
||||
process.end();
|
||||
arthasBootstrap.destroy();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,20 +1,42 @@
|
||||
package com.taobao.arthas.core.command.basic1000;
|
||||
|
||||
import com.alibaba.arthas.deps.org.slf4j.Logger;
|
||||
import com.alibaba.arthas.deps.org.slf4j.LoggerFactory;
|
||||
import com.taobao.arthas.core.command.model.MessageModel;
|
||||
import com.taobao.arthas.core.command.model.ResetModel;
|
||||
import com.taobao.arthas.core.command.model.ShutdownModel;
|
||||
import com.taobao.arthas.core.server.ArthasBootstrap;
|
||||
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
||||
import com.taobao.arthas.core.util.affect.EnhancerAffect;
|
||||
import com.taobao.middleware.cli.annotations.Name;
|
||||
import com.taobao.middleware.cli.annotations.Summary;
|
||||
|
||||
/**
|
||||
* Alias for ShutdownCommand
|
||||
* @author hengyunabc 2019-07-05
|
||||
* @see ShutdownCommand
|
||||
*/
|
||||
@Name("stop")
|
||||
@Summary("Stop/Shutdown Arthas server and exit the console.")
|
||||
public class StopCommand extends AnnotatedCommand {
|
||||
private static final Logger logger = LoggerFactory.getLogger(StopCommand.class);
|
||||
@Override
|
||||
public void process(CommandProcess process) {
|
||||
ShutdownCommand.shutdown(process);
|
||||
shutdown(process);
|
||||
}
|
||||
private static void shutdown(CommandProcess process) {
|
||||
ArthasBootstrap arthasBootstrap = ArthasBootstrap.getInstance();
|
||||
try {
|
||||
// 退出之前需要重置所有的增强类
|
||||
process.appendResult(new MessageModel("Resetting all enhanced classes ..."));
|
||||
EnhancerAffect enhancerAffect = arthasBootstrap.reset();
|
||||
process.appendResult(new ResetModel(enhancerAffect));
|
||||
process.appendResult(new ShutdownModel(true, "Arthas Server is going to shutdown..."));
|
||||
} catch (Throwable e) {
|
||||
logger.error("An error occurred when stopping arthas server.", e);
|
||||
process.appendResult(new ShutdownModel(false, "An error occurred when stopping arthas server."));
|
||||
} finally {
|
||||
process.end();
|
||||
arthasBootstrap.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.taobao.arthas.core.advisor;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.taobao.arthas.core.util.StringUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengyunabc 2021-07-14
|
||||
*
|
||||
*/
|
||||
public class SpyImplTest {
|
||||
|
||||
@Test
|
||||
public void testSplitMethodInfo() throws Throwable {
|
||||
Assertions.assertThat(StringUtils.splitMethodInfo("a|b")).containsExactly("a", "b");
|
||||
Assertions.assertThat(StringUtils.splitMethodInfo("xxxxxxxxxx|fffffffffff")).containsExactly("xxxxxxxxxx",
|
||||
"fffffffffff");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSplitInvokeInfo() throws Throwable {
|
||||
Assertions.assertThat(StringUtils.splitInvokeInfo("a|b|c")).containsExactly("a", "b", "c");
|
||||
Assertions.assertThat(StringUtils.splitInvokeInfo("xxxxxxxxxx|fffffffffff|yyy")).containsExactly("xxxxxxxxxx",
|
||||
"fffffffffff", "yyy");
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
@ -0,0 +1,7 @@
|
||||
cls
|
||||
===
|
||||
|
||||
clear current console.
|
||||
|
||||
> if not in tty mode,it will warn "Command 'cls' is only support tty session.".
|
||||
|
@ -0,0 +1,87 @@
|
||||
help
|
||||
===
|
||||
|
||||
show help message, the command can show all the commands that current Arthas server supports,or you can use the command to show the detail usage of another command.
|
||||
|
||||
> [help command] equals [command -help],both is to show the detail usage of one command.
|
||||
|
||||
### Options
|
||||
|
||||
| Name | Specification |
|
||||
| ------: | :-------------------------------------------------------- |
|
||||
| | show all the commands that current Arthas server supports |
|
||||
| [name:] | show the detail usage of one command |
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
$ help
|
||||
NAME DESCRIPTION
|
||||
help Display Arthas Help
|
||||
auth Authenticates the current session
|
||||
keymap Display all the available keymap for the specified connection.
|
||||
sc Search all the classes loaded by JVM
|
||||
sm Search the method of classes loaded by JVM
|
||||
classloader Show classloader info
|
||||
jad Decompile class
|
||||
getstatic Show the static field of a class
|
||||
monitor Monitor method execution statistics, e.g. total/success/failure count, average rt, fail rate, etc.
|
||||
stack Display the stack trace for the specified class and method
|
||||
thread Display thread info, thread stack
|
||||
trace Trace the execution time of specified method invocation.
|
||||
watch Display the input/output parameter, return object, and thrown exception of specified method invocation
|
||||
tt Time Tunnel
|
||||
jvm Display the target JVM information
|
||||
perfcounter Display the perf counter information.
|
||||
ognl Execute ognl expression.
|
||||
mc Memory compiler, compiles java files into bytecode and class files in memory.
|
||||
redefine Redefine classes. @see Instrumentation#redefineClasses(ClassDefinition...)
|
||||
retransform Retransform classes. @see Instrumentation#retransformClasses(Class...)
|
||||
dashboard Overview of target jvm's thread, memory, gc, vm, tomcat info.
|
||||
dump Dump class byte array from JVM
|
||||
heapdump Heap dump
|
||||
options View and change various Arthas options
|
||||
cls Clear the screen
|
||||
reset Reset all the enhanced classes
|
||||
version Display Arthas version
|
||||
session Display current session information
|
||||
sysprop Display, and change the system properties.
|
||||
sysenv Display the system env.
|
||||
vmoption Display, and update the vm diagnostic options.
|
||||
logger Print logger info, and update the logger level
|
||||
history Display command history
|
||||
cat Concatenate and print files
|
||||
base64 Encode and decode using Base64 representation
|
||||
echo write arguments to the standard output
|
||||
pwd Return working directory name
|
||||
mbean Display the mbean information
|
||||
grep grep command for pipes.
|
||||
tee tee command for pipes.
|
||||
profiler Async Profiler. https://github.com/jvm-profiling-tools/async-profiler
|
||||
stop Stop/Shutdown Arthas server and exit the console.
|
||||
|
||||
|
||||
```
|
||||
|
||||
```bash
|
||||
$ help dashboard
|
||||
USAGE:
|
||||
dashboard [-h] [-i <value>] [-n <value>]
|
||||
|
||||
SUMMARY:
|
||||
Overview of target jvm's thread, memory, gc, vm, tomcat info.
|
||||
|
||||
EXAMPLES:
|
||||
dashboard
|
||||
dashboard -n 10
|
||||
dashboard -i 2000
|
||||
|
||||
WIKI:
|
||||
https://arthas.aliyun.com/doc/dashboard
|
||||
|
||||
OPTIONS:
|
||||
-h, --help this help
|
||||
-i, --interval <value> The interval (in ms) between two executions, default is 5000 ms.
|
||||
-n, --number-of-execution <value> The number of times this command will be executed.
|
||||
```
|
||||
|
@ -0,0 +1,31 @@
|
||||
history
|
||||
===
|
||||
|
||||
view command history.
|
||||
|
||||
> history of commands will persisted in a file named history, so the history command can show all the history commands of current Arthas server ,but not only history in current session.
|
||||
|
||||
### Options
|
||||
|
||||
| Name | Specification |
|
||||
| ---: | :----------------------------- |
|
||||
| [c:] | clear all the history commands |
|
||||
| [n:] | view the nearest 5 commands |
|
||||
|
||||
### 使用参考
|
||||
|
||||
```bash
|
||||
#view the nearest 3 commands
|
||||
$ history 3
|
||||
269 thread
|
||||
270 cls
|
||||
271 history 3
|
||||
```
|
||||
|
||||
```bash
|
||||
#clear all the history commands
|
||||
$ history -c
|
||||
$ history 3
|
||||
1 history 3
|
||||
```
|
||||
|
@ -0,0 +1,7 @@
|
||||
quit
|
||||
===
|
||||
|
||||
exit the current Arthas client without affecting other clients. equals **exit**、**logout**、**q** command.
|
||||
|
||||
> just exit Arthas client,it means Arthas server is not closed,so the changes you do will not be reseted.
|
||||
|
@ -0,0 +1,7 @@
|
||||
Stop
|
||||
===
|
||||
|
||||
terminates the Arthas server, all the Arthas clients connecting to this server will be disconnected.
|
||||
|
||||
> the class redefined by redefine command will not be reset.
|
||||
|
@ -0,0 +1,12 @@
|
||||
version
|
||||
===
|
||||
|
||||
prints out Arthas's version.
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
$ version
|
||||
3.5.1
|
||||
```
|
||||
|
@ -0,0 +1,12 @@
|
||||
version
|
||||
===
|
||||
|
||||
输出当前目标 Java 进程所加载的 Arthas 版本号
|
||||
|
||||
### 使用参考
|
||||
|
||||
```
|
||||
$ version
|
||||
3.5.1
|
||||
```
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,22 @@
|
||||
package com.alibaba.arthas.tunnel.server.app;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hengyunabc 2021-07-12
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = { ArthasTunnelApplication.class })
|
||||
public class ArthasTunnelApplicationTest {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
System.out.println("hello");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
|
||||
通过`vmtool`命令,可以搜索内存对象。
|
||||
|
||||
`vmtool --action getInstances --className java.lang.String --limit 10`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ vmtool --action getInstances --className java.lang.String --limit 10
|
||||
@String[][
|
||||
@String[com/taobao/arthas/core/shell/session/Session],
|
||||
@String[com.taobao.arthas.core.shell.session.Session],
|
||||
@String[com/taobao/arthas/core/shell/session/Session],
|
||||
@String[com/taobao/arthas/core/shell/session/Session],
|
||||
@String[com/taobao/arthas/core/shell/session/Session.class],
|
||||
@String[com/taobao/arthas/core/shell/session/Session.class],
|
||||
@String[com/taobao/arthas/core/shell/session/Session.class],
|
||||
@String[com/],
|
||||
@String[java/util/concurrent/ConcurrentHashMap$ValueIterator],
|
||||
@String[java/util/concurrent/locks/LockSupport],
|
||||
]
|
||||
```
|
@ -0,0 +1,20 @@
|
||||
|
||||
The `vmtool` command can search object in JVM.
|
||||
|
||||
`vmtool --action getInstances --className java.lang.String --limit 10`{{execute T2}}
|
||||
|
||||
```bash
|
||||
$ vmtool --action getInstances --className java.lang.String --limit 10
|
||||
@String[][
|
||||
@String[com/taobao/arthas/core/shell/session/Session],
|
||||
@String[com.taobao.arthas.core.shell.session.Session],
|
||||
@String[com/taobao/arthas/core/shell/session/Session],
|
||||
@String[com/taobao/arthas/core/shell/session/Session],
|
||||
@String[com/taobao/arthas/core/shell/session/Session.class],
|
||||
@String[com/taobao/arthas/core/shell/session/Session.class],
|
||||
@String[com/taobao/arthas/core/shell/session/Session.class],
|
||||
@String[com/],
|
||||
@String[java/util/concurrent/ConcurrentHashMap$ValueIterator],
|
||||
@String[java/util/concurrent/locks/LockSupport],
|
||||
]
|
||||
```
|
Binary file not shown.
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 39 KiB |
Loading…
Reference in New Issue