Skip to content
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

8316649: JMX connection timeout cannot be changed and uses the default of 0 (infinite) #16856

Conversation

kevinjwalls
Copy link
Contributor

@kevinjwalls kevinjwalls commented Nov 28, 2023

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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Change requires CSR request JDK-8320580 to be approved
  • Commit message must refer to an issue

Issues

  • JDK-8316649: JMX connection timeout cannot be changed and uses the default of 0 (infinite) (Enhancement - P4)
  • JDK-8320580: JMX RMI Connections should have a connect timeout property (CSR)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16856/head:pull/16856
$ git checkout pull/16856

Update a local copy of the PR:
$ git checkout pull/16856
$ git pull https://git.openjdk.org/jdk.git pull/16856/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16856

View PR using the GUI difftool:
$ git pr show -t 16856

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16856.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2023

👋 Welcome back kevinw! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Nov 28, 2023
@openjdk
Copy link

openjdk bot commented Nov 28, 2023

@kevinjwalls The following labels will be automatically applied to this pull request:

  • jmx
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org jmx jmx-dev@openjdk.org labels Nov 28, 2023
@kevinjwalls kevinjwalls marked this pull request as ready for review November 28, 2023 17:20
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 28, 2023
@mlbridge
Copy link

mlbridge bot commented Nov 28, 2023

Webrevs

@dfuch
Copy link
Member

dfuch commented Nov 28, 2023

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.

@kevinjwalls
Copy link
Contributor Author

Thanks, that's right it is a bad interoperability problem!
The alternative SocketFactory needs to be available at all clients, so this is not workable.

The other possibility was use of RMISocketFactory::setSocketFactory on the JMX client end. This lets us substitute in a preferred socket factory before making a connection, and one which can implement its own timeout. This is awkward as it affects the whole process. For JMX apps such as JConsole etc this is fine, but in other situations it may have side-effects on other RMI activity. At the moment the demand for the timeout is not strong, and the behaviour is what it has been for many years, so I am going to close this without progressing it.

@kevinjwalls kevinjwalls closed this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Pull request needs approved CSR before integration jmx jmx-dev@openjdk.org rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants