jmap

Jmap - Error connecting to remote debug server


My requirement is to create a dump file of heap memory of a remote server using Jmap. I did this way.

jmap -dump:file=remoteDump.txt,format=b 3104

This worked fine as 3104 is the pid of a process from my local machine. How do I do the same with remote server? I tried

jmap -dump:file=remoteDump.txt,format=b 3104 54.197.228.33:8080

But it's failed. I tried creating a debug server using jsadebugd, as below. 1.Started rmiregistry

rmiregistry -J-Xbootclasspath/p:$JAVA_HOME/lib/sa-jdi.jar

2.Ran jsadebugd

>jsadebugd 11594 54.197.228.33:9009

But the step 2 is throwing the following error:

Error attaching to process or starting server: sun.jvm.hotspot.debugger.D
Exception: Windbg Error: WaitForEvent failed!
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.attach0(Na
thod)
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.attach(Win
ggerLocal.java:152)
        at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:
        at sun.jvm.hotspot.HotSpotAgent.setupDebuggerWin32(HotSpotAgent.j
)
        at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:3
        at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:313)
        at sun.jvm.hotspot.HotSpotAgent.startServer(HotSpotAgent.java:220
        at sun.jvm.hotspot.DebugServer.run(DebugServer.java:106)
        at sun.jvm.hotspot.DebugServer.main(DebugServer.java:45)
        at sun.jvm.hotspot.jdi.SADebugServer.main(SADebugServer.java:55)

Help me get out of it.


Solution

  • The reason why you can not attach to process could be that it is already attached to some other debuger or executed on other visual machine than your jmap is running.

    Try to assure that process is not attached to any debuger and you attach to the same VM.