1

I am trying to monitor native memory of tomcat using jcmd but getting following exception: Command: jcmd 14533<pid of tomcat> VM.native_memory summary

I have installed 2 jdk's jdk-11 AND jdk-8.

Tomcat is running by jdk-8 and jcmd used jdk-11 then i got following exception:

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/31752/root/tmp/.java_pid31752: target process 31752 doesn't respond within 10500ms or HotSpot VM not loaded at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:100) 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.jcmd.JCmd.executeCommandForPid(JCmd.java:114) at jdk.jcmd/sun.tools.jcmd.JCmd.main(JCmd.java:98) 

I attched -XX:+StartAttachListener with java process but it didn't work.

1

2 Answers 2

1

If you are running tomcat as a service on linux check following config in unit file i.e. tomcat.service

  1. PrivateTmp=yes, should be removed. As PrivateTmp=yes create private /tmp folder which is not accessible by tool
  2. If you have ProtectSystem=strict, add ReadWritePaths=/tmp/

Go through man page for systemd unit file config

Sign up to request clarification or add additional context in comments.

Comments

0

It can be a user permission issue: jmap has to be run with the same user as the java process. e.g. if the owner is usera and this is running in a docker contained execute jmap as user usera

docker exec --user usera -it container_id jmap -dump:format=b,file=/home/usera/memorydump.bin 1 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.