HeapDump generation using jmap in Jira pod fails with error: Unable to open socket file, target process <PID> doesn't respond within 10500ms or HotSpot VM not loaded
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When attempting to generate a HeapDump using the jmap tool in Jira deployed in Kubernetes, the following error occurs:
1
Exception in thread "main" com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/7/root/tmp/.java_pid7: target process 7 doesn't respond within 10500ms or HotSpot VM not loaded
Environment
Jira deployed in Kubernetes environment
Diagnosis
Login to Jira POD and run jmap command as mentioned in Analyze OutofMemory errors in Jira server with heap dumps to generate HeapDump
1
%JAVA_HOME%\bin\jmap -dump:format=b,file=heap.bin <pid>
Command fails with the following exception
1
2
3
4
5
6
7
8
9
thanos@0007as:/opt/java/openjdk/bin# jmap -dump:format=b,file=heap.bin 7
Exception in thread "main" com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/7/root/tmp/.java_pid7: target process 7 doesn't respond within 10500ms or HotSpot VM not loaded
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:104)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
at jdk.jcmd/sun.tools.jmap.JMap.executeCommandForPid(JMap.java:128)
at jdk.jcmd/sun.tools.jmap.JMap.dump(JMap.java:248)
at jdk.jcmd/sun.tools.jmap.JMap.main(JMap.java:114)
thanos@0007as:/opt/java/openjdk/bin#
Cause
To generate a HeapDump with the jmap command, it must be executed by the user who owns the Java application. Jira service inside the pod is owned by the 'jira' user. The error is encountered when jmap is executed as the 'root' user instead of the 'jira' user.
Solution
Follow the steps below to successfully generate a HeapDump:
Log in to the Jira Pod
Use the following command to access the Jira pod's shell:
1
kubectl exec -it <Jira-pod-name> -n <namespace> -- /bin/bash
Replace <Jira-pod-name> with the name of your Jira pod and <namespace> with the relevant namespace.
Identify the Jira Process ID
Run the following command to find the Jira process
1
ps -elf | grep java
Note the process ID (PID) associated with the Jira application.
Switch to the 'jira' User
To execute the jmap command, switch to the 'jira' user by executing:
1
su jira
Navigate to the Desired Directory
Change to the directory where you want to save the HeapDump file.
Generate the HeapDump
Run the following command to generate the HeapDump:
1
jmap -dump:format=b,file=heap.bin <pid>
Replace <pid> with the process ID of the Jira application obtained in step 2.
Was this helpful?