[alibaba/arthas]执行heapdump命令报错Host is down

2024-07-17 357 views
3
环境信息
  • arthas-boot.jar 或者 as.sh 的版本: 3.4.5
  • Arthas 版本: 3.4.5
  • 操作系统版本: Alpine Linux v3.8
  • 目标进程的JVM版本: 1.8.0_192
  • 执行arthas-boot的版本: 3.4.5
重现问题的步骤
  1. 执行heapdump命令
期望的结果

What do you expected from the above steps?

期望执行成功,输出Heap dump file created

实际运行的结果

报错。

Dumping heap to /opt/dump/xxx.hprof 
heap dump error: Host is down

回答

7

补充堆栈日志:

2023-08-17 10:46:10 arthas-NettyWebsocketTtyBootstrap-4-2] INFO c.t.arthas.core.util.ArthasBanner -Current arthas version: 3.4.5, recommend latest version: 3.7.0
2023-08-17 10:46:15 [arthas-command-execute] ERROR c.t.a.c.c.monitor200.HeapDumpCommand -heap dump error: Host is down java.io.IOException: Host is down
at sun.management. HotSpotDiagnostic.dumpHeap0(Native Method) at sun.management.HotSpotDiagnostic.dumpHeap(Unknown Source)
at com.taobao.arthas.core.command.monitor200.HeapDumpCommand.run(HeapDumpCommand.java:86)
at com.taobao.arthas.core.command .monitor200 .HeapDumpCommand.process (HeapDumpCommand. java:69)
at com.taobao.arthas.core.shell.command.imp1.AnnotatedCommandImp1.process(AnnotatedCommandImp].java:82)
at com.taobao.arthas.core.shell. command. impl.AnnotatedCommandImp1.access$100 (AnnotatedCommandImp1. java: 18)
at com.taobao.arthas.core.shell.command.imp1.AnnotatedCommandImp1$ProcessHandler.handle(AnnotatedCommandImp].java:111)
at com.taobao.arthas.core.shell.command.imp1.AnnotatedCommandImp1$ProcessHandler.handle(AnnotatedCommandImp1.java:108)
at com.taobao.arthas.core.shell.system.imp1.ProcessImp1$CommandProcessTask.run(ProcessImp1.java:385)
at java.util.concurrent. Executors$RunnableAdapter.call (Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent. ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang. Thread.run(Unknown Source)
9

对比了arthas源码,报错行为 hotSpotDiagnosticMXBean.dumpHeap(file, live);

对应的方法是 private static void run(CommandProcess process, String file, boolean live) throws IOException { HotSpotDiagnosticMXBean hotSpotDiagnosticMXBean = ManagementFactory .getPlatformMXBean(HotSpotDiagnosticMXBean.class); hotSpotDiagnosticMXBean.dumpHeap(file, live); }

0

这个调用的是jdk提供的 MBean,可以搜下其它解决办法,arthas本身没啥办法。