On Tue, 21 Nov 2023 17:57:32 GMT, Kevin Walls <kev...@openjdk.org> wrote:

> RMI Connections (in general) 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.
> 
> src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPChannel.java
> has other timeouts but nothing to control the initial Socket connect.
> 
> Defaulting to a 1 minute timeout on connect has no effect on existing tests 
> for RMI and JMX, and should go unnoticed in applications unless there really 
> is a significant connection delay.  Specifying zero for the new System 
> Property sun.rmi.transport.tcp.initialConnectTimeout uses the old code path 
> of a connect with no timeout.
> 
> I have a test, but it is not realistically usable: although specifying a 1 
> millisecond timeout will often fail (as expected/desired for the test), it 
> will often pass as the connection happens immediately.

It may be that changing the base RMI implementation isn't desirable.
I am bringing up a different implementation, using a new ClientSocketFactory 
for JMX which implements the connect timeout.

So a new JMX-specific property, not a general RMI property, and we limit the 
impact of the change, so it won't affect any other RMI apps.

I'm putting this in https://github.com/openjdk/jdk/pull/16856 it's in draft 
right now, I'll complete the details and see if it is a better way forward 
(will close this PR if the new one is better).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16771#issuecomment-1830309421

Reply via email to