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

JMXMP connector client throws IllegalStateException but should be IOException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.0.1
    • Fix Version/s: 1.0.1
    • Component/s: core-svc
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      1.0.1
    • CPU:
      generic
    • OS:
      generic

      Description

      When the JMXMP connector client gets a failed connection, subsequent operations (after the first one that encountered the failure) get IllegalStateException with a message "the connection has been closed". This is clearly wrong. It is already a bit questionable to throw this exception if the connection was explicitly closed, but it is definitely wrong to throw it if the connection has failed.

      This sometimes shows up with the unit test BrokenConnectionTest. In the test for removeNotificationListener, we set up a listener, break the connection, then remove the listener. Usually this correctly gets IOException for the attempt to remove the listener. Sometimes, though, the fetchNotifications thread happens to get the failure first, and it moves the connection state to FAILED. Then the removeNotificationListener gets IllegalStateException, with a trace like this:

      java.lang.IllegalStateException: The connection has been closed.
      at com.sun.jmx.remote.generic.SynchroMessageConnectionImpl.checkState(SynchroMessageConnectionImpl.java:555)
      at com.sun.jmx.remote.generic.SynchroMessageConnectionImpl.sendWithReturn(SynchroMessageConnectionImpl.java:164)
      at javax.management.remote.generic.ClientIntermediary.mBeanServerRequest(ClientIntermediary.java:954)
      at javax.management.remote.generic.ClientIntermediary.mBeanServerRequest(ClientIntermediary.java:936)
      at javax.management.remote.generic.ClientIntermediary.removeNotificationListener(ClientIntermediary.java:688)
      at javax.management.remote.generic.GenericConnector$RemoteMBeanServerConnection.removeNotificationListener(GenericConnector.java:593)
      at BrokenConnectionTest$4.operation(BrokenConnectionTest.java:153)
      at BrokenConnectionTest$Operation.test(BrokenConnectionTest.java:95)
      at BrokenConnectionTest.test(BrokenConnectionTest.java:449)
      at BrokenConnectionTest.jmxmpTest(BrokenConnectionTest.java:592)
      at BrokenConnectionTest.test(BrokenConnectionTest.java:64)
      at BrokenConnectionTest.main(BrokenConnectionTest.java:41)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sjiang Shanliang Jiang (Inactive)
                Reporter:
                emcmanus Eamonn McManus
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: