Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8316649

JMX connection timeout cannot be changed and uses the default of 0 (infinite)

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Java: openjdk version "17.0.2" 2022-01-18 LTS
      OS: Oracle Linux Server 7.9

      A DESCRIPTION OF THE PROBLEM :
      When my company disables a server the JMX socket connections hit a firewall that never returns a response. This can lead to resource leaks if I forcefully kill/interrupt the thread. It would be better if there was a configurable default for socket connection timeouts instead.

      The JMX connection does not allow for a connection timeout and relies on the default implementation of

          public void connect(SocketAddress endpoint) throws IOException {
              connect(endpoint, 0);
          }

      I would have expected an overridable setting similar to sun.net.client.defaultConnectTimeout. Below is the stack trace showing that JMX uses the default socket connection with infinite timeout:

             at java.net.Socket.connect(java.base@11.0.12/Socket.java:558)
              at java.net.Socket.<init>(java.base@11.0.12/Socket.java:454)
              at java.net.Socket.<init>(java.base@11.0.12/Socket.java:231)
              at sun.rmi.transport.tcp.TCPDirectSocketFactory.createSocket(java.rmi@11.0.12/TCPDirectSocketFactory.java:40)
              at sun.rmi.transport.tcp.TCPEndpoint.newSocket(java.rmi@11.0.12/TCPEndpoint.java:617)
              at sun.rmi.transport.tcp.TCPChannel.createConnection(java.rmi@11.0.12/TCPChannel.java:209)
              at sun.rmi.transport.tcp.TCPChannel.newConnection(java.rmi@11.0.12/TCPChannel.java:196)
              at sun.rmi.server.UnicastRef.newCall(java.rmi@11.0.12/UnicastRef.java:343)
              at sun.rmi.registry.RegistryImpl_Stub.lookup(java.rmi@11.0.12/RegistryImpl_Stub.java:116)
              at com.sun.jndi.rmi.registry.RegistryContext.lookup(jdk.naming.rmi@11.0.12/RegistryContext.java:133)
              at com.sun.jndi.toolkit.url.GenericURLContext.lookup(java.naming@11.0.12/GenericURLContext.java:207)
              at javax.naming.InitialContext.lookup(java.naming@11.0.12/InitialContext.java:409)
              at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(java.management.rmi@11.0.12/RMIConnector.java:1839)
              at javax.management.remote.rmi.RMIConnector.findRMIServer(java.management.rmi@11.0.12/RMIConnector.java:1813)
              at javax.management.remote.rmi.RMIConnector.connect(java.management.rmi@11.0.12/RMIConnector.java:302)



      Attachments

        Issue Links

          Activity

            People

              kevinw Kevin Walls
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: