RFR: 8316649: JMX connection timeout cannot be changed and uses the default of 0 (infinite)
Daniel Fuchs
dfuchs at openjdk.org
Tue Nov 28 17:59:08 UTC 2023
On Tue, 28 Nov 2023 16:21:29 GMT, Kevin Walls <kevinw at openjdk.org> wrote:
> JMX RMI Connections should use a timeout on the Socket connect call by default.
>
> JMX Connections use RMI and some connection failures never terminate. The hang described in 8316649 is hard to reproduce manually: the description says it can be caused by a firewall that never returns a response.
>
> Changing the base RMI implementation may not be desirable at this time.
>
> JMX can use a new ClientSocketFactory for RMI which implements the connect timeout, which can recognise a new JMX-specific property `com.sun.management.jmxremote.rmi.tcpConnectTimeout`
> (named like the existing com.sun.management.jmxremote... properties)
>
> Defaulting to a 1 minute timeout on connect has no effect on existing tests, and should go unnoticed unless there really is a significant connection delay. Specifying zero for the new System Property will use the old technique of a connect with no timeout.
>
> This can be tested, but it is not realistically usable: although specifying a 1 millisecond timeout will often fail (as expected/desired for the test), it will very often pass as the connection happens immediately.
I don't think that's a good idea. AFAIK the RMIClientSocketFactory is serialized and sent by the server to the client. This means, unless I'm mistaken, that you will not be able to use JDK 21 JConsole to connect to a JDK 22 VM. Try it :-)
If you chose to go this route then use of the factory should be an opt-in.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16856#issuecomment-1830389934
More information about the serviceability-dev
mailing list