laghdaf / jvmtop

Automatically exported from code.google.com/p/jvmtop
0 stars 0 forks source link

jvmstat cannot attach to JVM (Tomcat) #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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)

Original issue reported on code.google.com by christer...@devcode.se on 29 Apr 2013 at 7:27

GoogleCodeExporter commented 9 years ago
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?

Original comment by patric.r...@gmail.com on 11 May 2013 at 8:10

GoogleCodeExporter commented 9 years ago
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?

Original comment by nicflatt...@gmail.com on 24 May 2013 at 1:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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.

Original comment by patric.r...@gmail.com on 24 May 2013 at 2:11

GoogleCodeExporter commented 9 years ago
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.p
roperties -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.<init>(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.<init>(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)

Original comment by markshei...@gmail.com on 24 May 2013 at 7:02

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

Original comment by markshei...@gmail.com on 24 May 2013 at 7:04

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

Original comment by nicflatt...@gmail.com on 27 May 2013 at 2:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
@nicflatterie:
ok, thanks for clarification. Can you post the exceptions (reproduced with 
jvmtop  0.5.0) here?

Original comment by patric.r...@gmail.com on 27 May 2013 at 2:43

GoogleCodeExporter commented 9 years ago
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.<init>(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.<init>(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/loggin
g.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-to
mcat-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

Original comment by nicflatt...@gmail.com on 27 May 2013 at 4:58

GoogleCodeExporter commented 9 years ago
@nicflatterie
Can you please retry with 0.6.0 and tell me if this fixes the exceptions?

Original comment by patric.r...@gmail.com on 6 Jun 2013 at 4:09

GoogleCodeExporter commented 9 years ago

Original comment by patric.r...@gmail.com on 11 Jun 2013 at 6:41

GoogleCodeExporter commented 9 years ago
Changing this status to fixed. If you still seeing this issue, reopen or create 
a new issue.

Original comment by patric.r...@gmail.com on 18 Jul 2013 at 1:57

GoogleCodeExporter commented 9 years ago

Original comment by patric.r...@gmail.com on 18 Jul 2013 at 1:57