KBEC-00184 - Generating hprof files

Article ID:360033193111
2 minute readKnowledge base

Description

CloudBees CD (CloudBees Flow) Server is Java based. Sometimes generating a heap dump is an important debug tool.

Solution

Linux

As a prerequisite to following these steps, you will need to confirm that you have access to JCMD. If you cannot run:

JCMD -h

Please install openjdk-8 or openjdk-9

sudo apt get openjdk-9-jdk-headless

Please follow these steps, to Generate and Compress the HPROF file:

  • First, Go to the commander server and run the following command:

ps -auwwx | grep java | grep commander.log

This command will give us the PID of the EF server

  • Then, Input the PID into the following JCMD command:

jcmd PID GC.heap_dump

Example:

 jcmd 1315 GC.heap_dump /tmp/heap_dump_test.hprof
  • Then++Compress the HPROF file by using the Tar++ (compressing the file will save time for downloading and uploading the files generated):

tar -zcvf heap_dump.hprof.tar.gz heap_dump.hprof


Note:
If you receive an error during the hprof generation, please run the jcmd command as the same user as java process. In this case my user was ubuntu.

++Windows++

As a prerequisite to these steps, you will need to download the Java jdk. You will need teh jcmd application, which can be found in the default folder c:\Program files\java\jdk\bin

You will also need the microsoft tool psexec

Please follow these steps, to Generate and Compress the HPROF file:

  • Please find the PID of the Java process id service through the Task Manager app:

  • Go to the details of the service to get the PID:

  • Please use the pxexec tool to run the following jcmd command:

C:\Users\Administrator\Downloads\psexec -s "C:\Program Files\Java\jdk1.8.0_201\bin\jcmd"  GC.heap_dump \.hprof

Example:

C:\Users\Administrator\Downloads\psexec -s "C:\Program Files\Java\jdk1.8.0_201\bin\jcmd" 3952 GC.heap_dump c:/temp/mydump1.hprof
  • After the Hprof file has been generated, please Compress the File using either Gzip, 7z, or other compression tools. Compressing the file will save time for downloading and uploading.

After generating and compressing the hprof file, please forward the hprof file generated, your wrapper.conf files, and any details to support@cloudbees.com for analysis