Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
JVM Agent not compatible with -XX:+PerfDisableSharedMem #198
For some reason, the Jolokia agent does not appear to be compatible with the
I'm testing this against Cassandra. When running with the option:
$ java -jar ~/Downloads/jolokia-jvm-1.3.0-agent.jar list 6826 /home/thobbs/Downloads/jolokia-jvm-1.3.0-agent.jar list
And when running without the option (no other changes):
$ java -jar ~/Downloads/jolokia-jvm-1.3.0-agent.jar list 7108 /home/thobbs/Downloads/jolokia-jvm-1.3.0-agent.jar list 6917 org.apache.cassandra.service.CassandraDaemon
Although I don't think it makes a difference, this is my Java version:
added a commit
May 22, 2015
referenced this issue
May 22, 2015
The "list" command can only show the processes which comes out of
It seems that adding the parameter will prevents the JVM to be included.
What you still try is to find out the process id and connect directly to the process with
I was afraid that might be the answer. Thank you for taking the time to look into it anyway!
As you guessed, an error does occur if you try to connect to the process anyway:
$ java -jar jolokia-jvm-1.3.0-agent.jar list 29274 jolokia-jvm-1.3.0-agent.jar list $ pgrep -f CassandraDaemon 29040 $ java -jar jolokia-jvm-1.3.0-agent.jar start 29040 --verbose Illegal Argument (command: start) : Cannot attach to process-ID 29040. See --help for possible reasons. java.lang.IllegalArgumentException: Cannot attach to process-ID 29040. See --help for possible reasons. at org.jolokia.jvmagent.client.util.VirtualMachineHandler.getProcessId(VirtualMachineHandler.java:171) at org.jolokia.jvmagent.client.util.VirtualMachineHandler.attachVirtualMachine(VirtualMachineHandler.java:66) at org.jolokia.jvmagent.client.AgentLauncher.main(AgentLauncher.java:57)
I wonder why is the agent not able to connect when directly given a PID. This seems like an issue on agent rather than JVM, since a JMX client like JConsole is able to connect when directly given a PID.
I believe that
Actually, you are right, since the agent doesn't even try to attach to the PID if it is not listable, in order to give a meaningful error description. See here where this check happens:
This was also because I (falsely ?) assumed that every process which can be attached to is also listed.
I can move this check up and try nevertheless. Thanks for spotting this.