gpt4 book ai didi

java - 如何从 HashiCorp Nomad 运行的 java 应用程序获取堆转储?

转载 作者:行者123 更新时间:2023-11-30 06:40:35 25 4
gpt4 key购买 nike

我有由 HashiCorp Nomad 运行的 java 应用程序。在进程状态输出中,我有游牧执行程序进程运行 root和由nobody运行的java应用程序进程。

当我尝试执行命令时: jmap -dump:format=b,file=filename.bin <app_pid>

我收到消息:

Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding

当我尝试执行命令时:jmap -dump:format=b,file=filename.bin <app_pid> -F

我得到了下一个跟踪:

Attaching to core -F from executable 5584, please wait...
Error attaching to core file: cannot open binary file
sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:286)
at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:673)
at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:156)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:191)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.tools.jmap.JMap.runTool(JMap.java:201)
at sun.tools.jmap.JMap.main(JMap.java:130)

最佳答案

jmap不带 -F 的应该由与目标 Java 进程相同的用户运行(在您的情况下为 nobody)。

jmap -F应该由 root 运行,并且 -F参数应位于 <app_pid> 之前:

jmap -dump:format=b,file=filename.bin -F <app_pid>

详情请参阅this answers .

关于java - 如何从 HashiCorp Nomad 运行的 java 应用程序获取堆转储?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44433945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com