【问题标题】:Taking thread dump with jstack on java fails with socket file error在 java 上使用 jstack 进行线程转储失败并出现套接字文件错误
【发布时间】:2022-07-28 13:10:23
【问题描述】:

在 linux 机器上进行 Java 线程转储有时会失败并出现以下错误:-

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:106)

【问题讨论】:

    标签: java thread-dump jstack


    【解决方案1】:

    我们需要检查进程 id 是否存在 Java 套接字文件。 它创建一个带有 pid 的文件,例如。

    tmp/.java_pid1455
    

    如果该文件不存在,则执行线程转储的命令将失败。所以我们需要确保我们不会删除那个文件,否则我们需要重新启动 java 进程才能收回线程转储。

    参考:- https://confluence.atlassian.com/kb/jvm-is-not-reachable-with-jstat-and-jstack-1031281491.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-01
      • 1970-01-01
      • 2016-08-02
      • 1970-01-01
      相关资源
      最近更新 更多