alibaba / alibaba/arthas

同时trace同个class内不同method数据异常问题

Open
#2,872 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
37.5k
Forks
7.6k
Avg merge
1d 22h
Merged PRs (30d)
4

Description

### 环境信息

* `arthas-boot.jar` 或者 `as.sh` 的版本: 3.7.2
* Arthas 版本: 3.7.2
* 操作系统版本: win11
* 目标进程的JVM版本: 1.8
* 执行`arthas-boot`的版本: 3.7.2

### 重现问题的步骤

1. 这里增强时用了监控类+调用类+调用方法名+调用方法描述作为Key,当监控类内不同方法调用了调用类的同个方法,会导致数据混乱。
![image](https://github.com/user-attachments/assets/1626399a-5af7-4b53-bf7f-26a9a7368caf)

2. 测试用例
```
public class Test {
public static void main(String[] args) throws Exception {
A a = new A();
while (true) {
a.methodA();
a.methodB();
Thread.sleep(1000);
}
}

public static class A {
private B b = new B();

public void methodA() {
b.methodA();
b.methodB();
}

public void methodB() {
b.methodB();
b.methodA();
}
}

public static class B {
public void methodA() {
System.out.println("a");
}

public void methodB() {
System.out.println("b");
}
}
}

```
3. 启动Arthas客户端1,使用命令`trace Test$A methodA`
4. 启动Arthas客户端2,使用命令`trace Test$A methodB`

### 期望的结果
Arthas客户端1
![image](https://github.com/user-attachments/assets/10da2d71-d8d6-4655-b412-84895a7dc760)

Arthas客户端2
![image](https://github.com/user-attachments/assets/c95b0444-9188-42d5-98ab-5f3abef9fb29)

### 实际运行的结果
Arthas客户端1
![image](https://github.com/user-attachments/assets/792de54d-32e3-4cd2-b44f-8274ec147380)

Arthas客户端2
![image](https://github.com/user-attachments/assets/f1517ee1-54fb-4d6a-b863-3c04eea25e82)

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the supplied Java Test class and two concurrent `trace Test$A methodA` and `trace Test$A methodB` commands. Start by following the trace implementation where the monitoring class, called class, method name, and descriptor form the key; done means each client reports only its selected method's data without mixing results.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.