-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JVM Agent not compatible with -XX:+PerfDisableSharedMem #198
Comments
This is a workaround for jolokia/jolokia#198
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'm afraid that I can't do much here from Jolokia's side. Its more a bug of the JVM, but since I'm using some 'non-official' API (in the And thanks for finding out, btw ;-) |
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) |
Sorry for that ;-(. Some last note, which often gets overseen: You need to run under the exact same UID as the JVM process is running with. Strangely, it is not enough to call this under UID 0. This is probably not the case here, just want to mention it ;-) |
BTW, the UID restriction got introduced not too long ago with updates of Java8 (I think 8u11 still worked with UID 0, and 8u40 definitely doesn't anymore). |
I have the UID also for Java 7 (however don't know exactly at which version). |
Just want to say this thread really helped me out a lot. Thanks guys. |
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 Thanks |
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: https://github.com/rhuss/jolokia/blob/95f928f084f60ad67738c37ab4368cd82ec2bae9/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java#L182-L182 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. |
Now it will be always tried to connect, even when the PID is not listed. Also an internal retry to retrieve the agent URL as it seems there is some delay in launching it.
Thanks for the quick fix. When will 1.3.7 get released? |
There's no schedule yet, but I hope until this end of this month. |
…m workaround jolokia/jolokia#198 has been fixed since jolokia 1.3.7, so there is no reason to keep the remove_perf_disable_shared_mem workaround anymore. It is assumed that the '-XX:-PerfDisableSharedMem' usage was added exclusively for jolokia as well. patch by Christopher Lambert; reviewed by Mick Semb Wever
…m workaround jolokia/jolokia#198 has been fixed since jolokia 1.3.7, so there is no reason to keep the remove_perf_disable_shared_mem workaround anymore. It is assumed that the '-XX:-PerfDisableSharedMem' usage was added exclusively for jolokia as well. patch by Christopher Lambert; reviewed by Mick Semb Wever
…m workaround jolokia/jolokia#198 has been fixed since jolokia 1.3.7, so there is no reason to keep the remove_perf_disable_shared_mem workaround anymore. It is assumed that the '-XX:-PerfDisableSharedMem' usage was added exclusively for jolokia as well. patch by Christopher Lambert; reviewed by Mick Semb Wever
…m workaround jolokia/jolokia#198 has been fixed since jolokia 1.3.7, so there is no reason to keep the remove_perf_disable_shared_mem workaround anymore. It is assumed that the '-XX:-PerfDisableSharedMem' usage was added exclusively for jolokia as well. patch by Christopher Lambert; reviewed by Mick Semb Wever
For some reason, the Jolokia agent does not appear to be compatible with the
-XX:+PerfDisableSharedMem
JVM option.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:
The text was updated successfully, but these errors were encountered: