1

I have java application that running by HashiCorp Nomad. At process status output I have nomad executor process running by root and java app process running by nobody.

When I try execute command: jmap -dump:format=b,file=filename.bin <app_pid>

I got message:

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

When I try execute command: jmap -dump:format=b,file=filename.bin <app_pid> -F

I got next trace:

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)

trincot
  • 317,000
  • 35
  • 244
  • 286

1 Answers1

1

jmap without -F should be run by the same user as the target Java process (nobody in your case).

jmap -F should be run by root, and -F argument should precede <app_pid>:

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

See details in this answers.

apangin
  • 92,924
  • 10
  • 193
  • 247