Wednesday, February 20, 2013

"Not enough storage is available to process this command" while using jmap or jstack


Issue :
Sometimes while using a tools like jmap,jstack on a running java process, we are not able to connect to the java process and below error is observed.

Not enough storage is available to process this command 
[Note : Here PID  is the process id of java process whose dump is to be captured.]


Error Message

Solution :

Scenario 1)
If the service is running as a specific user, you need connect by logging into the same session and then try to run jmap or jstack etc.

Scenario 2)
If you are using Remote Desktop, you need to connect using "mstsc /admin" (used to be /console) and try to run jmap or jstack again

Scenario 3) 
Target Java process is running as System Process (in case of Windows)
In case if the target java process is running as System Process, we need to use PsExec utility.
Steps to use PsExec utility :
1) Download the PsTools from here.
2) Unzip the PsTools and copy the PsExec.exe
3) Execute the original command using PsExec utility with -s
    Syntax :
  PsExec -s {original_command}

    Example :
    PsExec -s jmap -dump:format=b,file=c:/heapdump.bin 4708    
Example - Executing  jmap using psexec.

1 comment: