unable to connect to JVM via JMX
wirowka opened this issue · 2 comments
Describe the bug
We run for a long time in our Linux machines the version: amazon-corretto-8.242.07.1, today we updated to: amazon-corretto-8.362.08.1
The old VM version supported configuration where both below ports were set to the same value, e.g.:
-Dcom.sun.management.jmxremote.port=6091
-Dcom.sun.management.jmxremote.rmi.port=6091
Because of that we were able to connect to it via remote JMX connection, e.g.: using VisualVM from another machine (Windows) running in our data center. Currently the above setup is not longer possible, we are getting:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 6091; nested exception is:
java.net.BindException: Address already in use (Bind failed)
sun.management.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 6091; nested exception is:
java.net.BindException: Address already in use (Bind failed)
at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:480)
at sun.management.Agent.startAgent(Agent.java:262)
at sun.management.Agent.startAgent(Agent.java:452)
Caused by: java.rmi.server.ExportException: Port already in use: 6091; nested exception is:
java.net.BindException: Address already in use (Bind failed)
During VM boot.
To Reproduce
run JVM with both below ports set to the same value:
-Dcom.sun.management.jmxremote.port=6091
-Dcom.sun.management.jmxremote.rmi.port=6091
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.access.file=/tmp/jmx_prometheus_javaagent/jmxremote.access
-Dcom.sun.management.jmxremote.password.file=/tmp/jmx_prometheus_javaagent/jmxremote.password
Expected behavior
JVM boots successfully, the same like in an older version (amazon-corretto-8.242.07)
Screenshots
If applicable, add screenshots to help explain your problem.
Platform information
Red Hat Enterprise Linux release 8.4 (Ootpa)
amazon-corretto-8.362.08.1
Thanks for reporting.
I can't reproduced the failure locally with 8.362.08.1:
./amazon-corretto-8.362.08.1-linux-x64/bin/java \
-Dcom.sun.management.jmxremote.port=6091 \
-Dcom.sun.management.jmxremote.rmi.port=6091 \
-Dcom.sun.management.jmxremote.authenticate=true \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.access.file=/tmp/jmx_prometheus_javaagent/jmxremote.access \
-Dcom.sun.management.jmxremote.password.file=/tmp/jmx_prometheus_javaagent/jmxremote.password \
-version
openjdk version "1.8.0_362"
OpenJDK Runtime Environment Corretto-8.362.08.1 (build 1.8.0_362-b08)
OpenJDK 64-Bit Server VM Corretto-8.362.08.1 (build 25.362-b08, mixed mode)
It does appear to be rather sensitive though, for example omitting the ssl=false flag does cause the BindException you shared. Could you try running the command I shared and see if that works for you?
As a workaround, is there a reason you can't use two separate ports?
Thank you for the quick check and reaction! Finally it turn out that the issue was not caused by JVM, but by the new release of the software, which incorrectly distributed the configuration change from the central management software component to the underlying agents. Closing the bug.