allwmh / jvmtop

Automatically exported from code.google.com/p/jvmtop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Throws Agent JAR loaded but agent failed to initialize

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1.Process running under root.
2.Execute jvmtop.sh <pid> at command-line


What is the expected output? What do you see instead?
Throws below exception:
[ java.io.IOException: Agent JAR loaded but agent failed to initialize
    at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:378)
    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:207)
    at com.jvmtop.VMInfo.processNewVM(VMInfo.java:163)
    at com.jvmtop.VMDetailView.<init>(VMDetailView.java:26)
    at com.jvmtop.JvmTop.main(JvmTop.java:35)
Caused by: com.sun.tools.attach.AgentInitializationException: Agent JAR loaded 
but agent failed to initialize
    at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:103)
    at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:368)
    ... 7 more ]

What version of jvmtop are you using? On what operating system?
jvmtop version : jvmtop 0.6.0 alpha

Please post the output of the following commands:
java -version :
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode) 

echo $JAVA_HOME  (for unix/linux systems):
/opt/jdk1.6.0_16

echo %JAVA_HOME% (for windows)


Please provide any additional information below.


Original issue reported on code.google.com by yamini.p...@gmail.com on 17 Jun 2013 at 4:30

Hi,

in which OS are you seeing this problem?
Does it print the exception only once after starting jvmtop?
If so does jvmtop crash after throwing this exception or does it run normally 
afterwards?

Original comment by patric.r...@gmail.com on 18 Jun 2013 at 10:30

Hi,
1. I am using Fedora release 13 (Goddard) OS.
2. Yes. It is printing only once. And exiting jvmtop.
below exception is thrown.
[[root@yamini-dt Downloads]# ./jvmtop.sh 9092
java.io.IOException: Agent JAR loaded but agent failed to initialize
    at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:378)
    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:207)
    at com.jvmtop.VMInfo.processNewVM(VMInfo.java:163)
    at com.jvmtop.VMDetailView.<init>(VMDetailView.java:26)
    at com.jvmtop.JvmTop.main(JvmTop.java:35)
Caused by: com.sun.tools.attach.AgentInitializationException: Agent JAR loaded 
but agent failed to initialize
    at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:103)
    at com.jvmtop.openjdk.tools.LocalVirtualMachine.loadManagementAgent(LocalVirtualMachine.java:368)
    ... 7 more

 JvmTop 0.6.0 alpha          amd64,  4 cpus, Linux 2.6.34.8-
 http://code.google.com/p/jvmtop

ERROR: Could not attach to process.]

3. jvmtop is not running after above exception.
After above exception, If I execute jvmtop.sh <pid> where pid = process running 
under user. Its running normal.

I am running small java program under root. jvmtop.sh <pid> works fine. But on 
web application's pid its not. 
I am using jboss-5.1.0.GA server. My server is up and running.


Original comment by yamini.p...@gmail.com on 18 Jun 2013 at 11:08

Hi,

thanks for the update.
I was able to reproduce this issue.

The root cause of this is that the jvm is most probably not responding or 
restricted its management attach mechanism.
You can try executing jstack 9092 - it will most probably also stop with an 
error message - so unfortunately there's nothing jvmtop can do for this jvm.

However, an exception should not be displayed here as this a regular use case.
I will change jvmtop to catch this exception and display a meaningful status in 
the overview view.

Original comment by patric.r...@gmail.com on 25 Jun 2013 at 4:44

  • Changed state: Accepted
Hi,

Apologies for late reply. jstack works fine on this pid.

Here is the command output.

[root@yamini-dt yamini]# jstack 9092
2013-07-08 11:33:52
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.1-b02 mixed mode):

"Attach Listener" daemon prio=10 tid=0x00007fc84c003000 nid=0x14b1 waiting on 
condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"pool-23-thread-2" prio=10 tid=0x00007fc834009800 nid=0x5d7c waiting on 
condition [0x00007fc7f3972000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000000b23331c8> (a java.util.concurrent.SynchronousQueue$TransferStack)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:422)
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:323)
    at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:857)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:662)

Original comment by yamini.p...@gmail.com on 8 Jul 2013 at 6:37

@all : Please retest if jvmtop 0.8.0 is fixing the attaching issues.

Please let us know if the issues are fixed - or post what is not yet working.

Original comment by patric.r...@gmail.com on 14 Aug 2013 at 2:46