Export to GitHub

jvmtop - issue #4

jvmstat cannot attach to JVM (Tomcat)


Posted on Apr 29, 2013 by Massive Wombat

When I run jvmstat.sh I get following error message

JvmTop 0.4.1 alpha (expect bugs) amd64, 1 cpus, Linux 3.4.28-2. http://code.google.com/p/jvmtop

PID MAIN-CLASS HPCUR HPMAX NHCUR NHMAX CPU GC VM USERNAME #T DL 1136 m.jvmtop.JvmTop 14m 958m 8m 130m 3.86% 0.00% 1.7.0 root 12 10449 artup.Bootstrap [ERROR: Could not attach to VM]

If I specify the pid I get following error message

Error while attaching vm 10449 com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:102) at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63) at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213) at com.jvmtop.VMInfo.processNewVM(VMInfo.java:138) at com.jvmtop.VMDetailView.<init>(VMDetailView.java:24) at com.jvmtop.JvmTop.main(JvmTop.java:35) Exception in thread "main" java.lang.NullPointerException at com.jvmtop.VMDetailView.printView(VMDetailView.java:32) at com.jvmtop.JvmTop.run(JvmTop.java:70) at com.jvmtop.JvmTop.main(JvmTop.java:35)

I'm using: Linux 3.4.28-2.20-desktop #1 SMP PREEMPT Tue Jan 29 16:51:37 UTC 2013 (143156b) x86_64 x86_64 x86_64 GNU/Linux java version "1.7.0" Java(TM) SE Runtime Environment (build 1.7.0-b147) Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

Comment #1

Posted on May 11, 2013 by Grumpy Hippo

Thanks for this issue report. Before looking deeply into this, one thing would be very interesting:

Can you attach to the problematic process using jconsole?

Comment #2

Posted on May 24, 2013 by Massive Elephant

I reproduced the problem, here are some details:

I run jvmtop.sh and I can attach to JVMs running ZooKeeper. These JVMs use JDK:

inter01 bin # ./java -version java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode) inter01 bin # pwd /inter/zkadm1/jdk1.7.0_21/bin

But I cannot attach to tomcat JVMs. These JVMs use JRE:

inter01 bin # ./java -version java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode) inter01 bin # pwd /inter/tcatadm1/jre1.7.0_17/bin

Jconsole is not included in the JRE. But if I use the JConsole included in the JDK to attach to the JRE JVMS (!) it does NOT work. Could it be that it cannot attach to a JRE, and only a JDK JVM?

Comment #3

Posted on May 24, 2013 by Grumpy Hippo

Comment deleted

Comment #4

Posted on May 24, 2013 by Grumpy Hippo

Thanks for the details. jvmtop should be able to connect to JVMs which are running under a JRE only. But I'm not sure if this is really the problem here.

Could you please retry this using jvmtop version 0.5.0? If still exceptions occur, please paste them here.

Comment #5

Posted on May 24, 2013 by Helpful Ox

I'm seeing same error. Is this supposed to be able to run on a linux server running a JVM? ps -ef|grep 26368 ssn 26368 1 10 16:46 pts/0 00:14:41 /usr/ssn/thirdparty/ssnjdk/CURRENT/ssn_home/ssnjdk/jdk/bin/java -Djava.util.logging.config.file=/usr/ssn/fwu/CURRENT/ssn_home/fwu/conf/logging.properties -server -Xms18g -Xmx18g -XX:NewSize=4500m -Xloggc:/usr/ssn/fwu/CURRENT/ssn_home/fwu/logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -verbose:gc -XX:ParallelCMSThreads=8 -XX:ParallelGCThreads=8 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseLargePages -XX:MaxPermSize=512m -XX:+UseMembar -Dsun.rmi.dgc.server.gcInterval=0x7FFFFFFFFFFFFFFE -Dsun.rmi.dgc.client.gcInterval=0x7FFFFFFFFFFFFFFE -Dserver.home.dir=/usr/ssn/fwu/CURRENT/ssn_home/fwu/logs -Dlog4j.configuration=file:///usr/ssn/fwu/CURRENT/ssn_home/fwu/conf/log4j.xml -Dconfig.properties=/usr/ssn/fwu/CURRENT/ssn_home/fwu/etc/config.properties -Djava.awt.headless=true -Dproject.build.finalName=fwu -Ddoc.root=/usr/ssn/fwu/CURRENT/ssn_home/fwu/webapps/fwu.war -Dui.debug.mode=false -DSSN_FWU_SHUTDOWN_PORT=4005 -DSSN_FWU_HTTP_PORT=4080 -DSSN_FWU_HTTP_BIND_ADDRESS=0.0.0.0 -DSSN_FWU_SSL_HTTP_PORT=4443 -DSSN_FWU_HTTPS_BIND_ADDRESS=0.0.0.0 -DSSN_FWU_AJP_PORT=4009 -DSSN_FWU_AJP_BIND_ADDRESS=0.0.0.0 -DSSN_FWU_SSL_KEY_LOCATION=/release/integ/FOR_QA_ONLY/certs/ssn/server.key -Dssnjms.host= -Dssnjms.jndi.port= -Dssnjms.auth.user= -Dssnjms.auth.password= -Duser.timezone=GMT -Djava.net.preferIPv4Stack=false -DuiqUrl=https://sfossnse01vmw73.silverspringnet.com:3009 -Dversion=4.8.0 -Dbuild=233749 -Dlog.file.max.size=10MB -Dlog.file.count=10 -DSSN_FWU_SECURITY_SESSION_TIMEOUT_MINUTES=30 -Djava.library.path=/usr/ssn/fwu/CURRENT/ssn_home/fwu/lib -Dconfig.properties=/usr/ssn/fwu/CURRENT/ssn_home/fwu/etc/config.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/ssn/thirdparty/tomcat/CURRENT/endorsed -classpath :/usr/ssn/thirdparty/tomcat/CURRENT/bin/bootstrap.jar -Dcatalina.base=/usr/ssn/fwu/CURRENT/ssn_home/fwu -Dcatalina.home=/usr/ssn/thirdparty/tomcat/CURRENT -Djava.io.tmpdir=/usr/ssn/fwu/CURRENT/ssn_home/fwu/temp org.apache.catalina.startup.Bootstrap start

./jvmtop.sh 26368 java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:341) at com.jvmtop.openjdk.tools.LocalVirtualMachine.startManagementAgent(LocalVirtualMachine.java:137) at com.jvmtop.openjdk.tools.ProxyClient.tryConnect(ProxyClient.java:367) at com.jvmtop.openjdk.tools.ProxyClient.connect(ProxyClient.java:349) at com.jvmtop.VMInfo.attachToVM(VMInfo.java:187) at com.jvmtop.VMInfo.processNewVM(VMInfo.java:146) at com.jvmtop.VMDetailView.(VMDetailView.java:26) at com.jvmtop.JvmTop.main(JvmTop.java:35) Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:82) at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:46) at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:195) at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:337) ... 7 more Exception in thread "main" java.lang.NullPointerException at com.jvmtop.VMDetailView.printView(VMDetailView.java:44) at com.jvmtop.JvmTop.run(JvmTop.java:70) at com.jvmtop.JvmTop.main(JvmTop.java:35)

Comment #6

Posted on May 24, 2013 by Helpful Ox

Nevermind. I was able to run it as the user who launched the process, but not as root. Message seems a bit obscure...

Comment #7

Posted on May 27, 2013 by Massive Elephant

Follow up to my message #2 on May 24th. I did that test with V5, downloaded on that day.

Comment #8

Posted on May 27, 2013 by Grumpy Hippo

Comment deleted

Comment #9

Posted on May 27, 2013 by Grumpy Hippo

@nicflatterie: ok, thanks for clarification. Can you post the exceptions (reproduced with jvmtop 0.5.0) here?

Comment #10

Posted on May 27, 2013 by Massive Elephant

There you go, I hope it helps. Mint 14, JVMTop 0.5.0:

inter01 jvmtop # ./jvmtop.sh 22654 java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:341) at com.jvmtop.openjdk.tools.LocalVirtualMachine.startManagementAgent(LocalVirtualMachine.java:137) at com.jvmtop.openjdk.tools.ProxyClient.tryConnect(ProxyClient.java:367) at com.jvmtop.openjdk.tools.ProxyClient.connect(ProxyClient.java:349) at com.jvmtop.VMInfo.attachToVM(VMInfo.java:187) at com.jvmtop.VMInfo.processNewVM(VMInfo.java:146) at com.jvmtop.VMDetailView.(VMDetailView.java:26) at com.jvmtop.JvmTop.main(JvmTop.java:35) Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:106) at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63) at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213) at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:337) ... 7 more Exception in thread "main" java.lang.NullPointerException at com.jvmtop.VMDetailView.printView(VMDetailView.java:44) at com.jvmtop.JvmTop.run(JvmTop.java:70) at com.jvmtop.JvmTop.main(JvmTop.java:35) inter01 jvmtop # inter01 jvmtop # whoami root inter01 jvmtop # inter01 jvmtop # ps -ef|grep 22654 tcatadm4 22654 1 0 May24 ? 00:03:11 /inter/tcatadm4/jre1.7.0_17/bin/java -Djava.util.logging.config.file=/inter/tcatadm4/apache-tomcat-7.0.39/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/inter/tcatadm4/jdk-gc.log -XX:+DisableExplicitGC -Dlog4j.configuration=file:/inter/solradm4/log4j.properties -Dfile.encoding=utf-8 -Xms128m -Xmx256m -Dcollection.configName=ThreeFourConfig -DzkHost=localhost:2181,localhost:2182,localhost:2183 -Djava.endorsed.dirs=/inter/tcatadm4/apache-tomcat-7.0.39/endorsed -classpath /inter/tcatadm4/apache-tomcat-7.0.39/bin/bootstrap.jar:/inter/tcatadm4/apache-tomcat-7.0.39/bin/tomcat-juli.jar -Dcatalina.base=/inter/tcatadm4/apache-tomcat-7.0.39 -Dcatalina.home=/inter/tcatadm4/apache-tomcat-7.0.39 -Djava.io.tmpdir=/inter/tcatadm4/apache-tomcat-7.0.39/temp org.apache.catalina.startup.Bootstrap start root 25264 25148 0 12:52 pts/2 00:00:00 grep --colour=auto 22654

Comment #11

Posted on Jun 6, 2013 by Grumpy Hippo

@nicflatterie Can you please retry with 0.6.0 and tell me if this fixes the exceptions?

Comment #12

Posted on Jun 11, 2013 by Grumpy Hippo

(No comment was entered for this change.)

Comment #13

Posted on Jul 18, 2013 by Grumpy Hippo

Changing this status to fixed. If you still seeing this issue, reopen or create a new issue.

Comment #14

Posted on Jul 18, 2013 by Grumpy Hippo

(No comment was entered for this change.)

Status: Fixed

Labels:
Type-Defect Priority-Medium