[alibaba/arthas]【openj9场合下的使用问题】trace指令使用报错

2024-07-17 440 views
7
环境信息
  • arthas-boot.jar 或者 as.sh 的版本:3.6.6
  • Arthas 版本: 3.6.6
  • 操作系统版本: macos m1
  • 目标进程的JVM版本: openj9-jdk8
  • 执行arthas-boot的版本: openj9-jdk8
重现问题的步骤
  1. 使用openj9启动应用
  2. 使用openj9启动arthas-boot并attach对应进程
  3. 执行classloader -t找到对应classloader
  4. 执行classloader -c d837015e --load org.springframework.boot.SpringApplication
  5. 执行trace org.springframework '#cost > 1000'
  6. 报错
期望的结果

正常输出trace

实际运行的结果
[arthas@22508]$ trace org.springframework* * '#cost > 1000'
Affect(class count: 4180 , method count: 33388) cost in 28438 ms, listenerId: 1
Enhance error! exception: java.lang.VerifyError
error happens when enhancing class: null, check arthas log: /Users/logs/arthas/arthas.log
java.lang.RuntimeException: java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage
        at com.alibaba.bytekit.asm.ClassLoaderAwareClassWriter.getCommonSuperClass(ClassLoaderAwareClassWriter.java:42)
        at com.alibaba.deps.org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1202)
        at com.alibaba.deps.org.objectweb.asm.Frame.merge(Frame.java:1299)
        at com.alibaba.deps.org.objectweb.asm.Frame.merge(Frame.java:1244)
        at com.alibaba.deps.org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1611)
        at com.alibaba.deps.org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1547)
        at com.alibaba.deps.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:767)
        at com.alibaba.deps.org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:647)
        at com.alibaba.deps.org.objectweb.asm.tree.ClassNode.accept(ClassNode.java:451)
        at com.alibaba.bytekit.utils.AsmUtils.toBytes(AsmUtils.java:78)
        at com.taobao.arthas.core.advisor.Enhancer.transform(Enhancer.java:256)
        at com.taobao.arthas.core.advisor.TransformerManager$1.transform(TransformerManager.java:59)
        at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:443)
        at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
        at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:156)
        at com.taobao.arthas.core.advisor.Enhancer.enhance(Enhancer.java:446)
        at com.taobao.arthas.core.command.monitor200.EnhancerCommand.enhance(EnhancerCommand.java:162)
        at com.taobao.arthas.core.command.monitor200.EnhancerCommand.process(EnhancerCommand.java:109)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.process(AnnotatedCommandImpl.java:82)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.access$100(AnnotatedCommandImpl.java:18)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:111)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:108)
        at com.taobao.arthas.core.shell.system.impl.ProcessImpl$CommandProcessTask.run(ProcessImpl.java:385)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:826)
Caused by: java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage
        at java.lang.Class.forNameImpl(Native Method)
        at java.lang.Class.forName(Class.java:411)
        at com.alibaba.bytekit.asm.ClassLoaderAwareClassWriter.getCommonSuperClass(ClassLoaderAwareClassWriter.java:40)
        ... 30 common frames omitted
2023-03-28 14:52:21 [arthas-command-execute] WARN  c.t.arthas.core.advisor.Enhancer -transform loader[org.springframework.boot.loader.LaunchedURLClassLoader@d837015e]:class[org/springframework/cloud/openfeign/ribbon/RetryableFeignLoadBalancer] failed.
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.springframework.retry.policy.NeverRetryPolicy
        at com.alibaba.bytekit.asm.ClassLoaderAwareClassWriter.getCommonSuperClass(ClassLoaderAwareClassWriter.java:42)

java.lang.VerifyError: null
        at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
        at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:156)
        at com.taobao.arthas.core.advisor.Enhancer.enhance(Enhancer.java:446)
        at com.taobao.arthas.core.command.monitor200.EnhancerCommand.enhance(EnhancerCommand.java:162)
        at com.taobao.arthas.core.command.monitor200.EnhancerCommand.process(EnhancerCommand.java:109)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.process(AnnotatedCommandImpl.java:82)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.access$100(AnnotatedCommandImpl.java:18)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:111)
        at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:108)
        at com.taobao.arthas.core.shell.system.impl.ProcessImpl$CommandProcessTask.run(ProcessImpl.java:385)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:826)

怀疑arthas对于openj9的支持存在问题

回答

1
  • 假如可以,请给我们一个demo应用,方便排查问题
3

应用本身没有特殊,使用springboot应用应该都能够复现问题。主要应该是和OpenJ9虚拟机本身有关。我使用的jar包方式启动,因此类加载器是org.springframework.boot.loader.LaunchedURLClassLoader

6

我的openj9版本号是

openjdk version "1.8.0_362"
IBM Semeru Runtime Open Edition (build 1.8.0_362-b07)
Eclipse OpenJ9 VM (build v0.36.0-release-c5da55ccc, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20230113_599 (JIT enabled, AOT enabled)
OpenJ9   - c5da55ccc
OMR      - 2bb04132e
JCL      - 1a94e3037e based on jdk8u362-b07)
4

我们这里用的IBM WEBSPHERE系统也是ibm的jdk,arthas没法使用。

3

目前只支持 openjdk 系列的。