Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhong-jie opened this issue Jul 19, 2024 · 0 comments
Open

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

zhong-jie opened this issue Jul 19, 2024 · 0 comments

Comments

@zhong-jie
Copy link

zhong-jie commented Jul 19, 2024

环境信息

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

重现问题的步骤

  1. 这里增强时用了监控类+调用类+调用方法名+调用方法描述作为Key,当监控类内不同方法调用了调用类的同个方法,会导致数据混乱。
    image

  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");
        }
    }
}

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

期望的结果

Arthas客户端1
image

Arthas客户端2
image

实际运行的结果

Arthas客户端1
image

Arthas客户端2
image

@zhong-jie zhong-jie changed the title Enhancer增强trace 同时trace同个class内不同method数据异常问题 Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant