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

ThreadMXBean.dumpAllThreads() fails with "java.io.InvalidObjectException: Failed to invoke from(CompositeData)"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 7, 8
    • Fix Version/s: None
    • Component/s: core-svc
    • Labels:
      None

      Description

      When running JMX client on JDK 8 and JMX server on JDK 9 build 133 it becomes impossible to use 'ThreadMXBean.dumpAllThreads()'.

      Any attempt ends with:
      java.lang.IllegalArgumentException: Unexpected composite type for ThreadInfo
      at sun.management.ThreadInfoCompositeData.validateCompositeData(ThreadInfoCompositeData.java:372)
      at sun.management.ThreadInfoCompositeData.getInstance(ThreadInfoCompositeData.java:68)
      at java.lang.management.ThreadInfo.<init>(ThreadInfo.java:263)
      at java.lang.management.ThreadInfo.from(ThreadInfo.java:794)
      Caused: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaFrom.fromCompositeData(DefaultMXBeanMappingFactory.java:1018)
      Caused: java.io.InvalidObjectException: Failed to invoke from(CompositeData)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory.invalidObjectException(DefaultMXBeanMappingFactory.java:1457)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeBuilderViaFrom.fromCompositeData(DefaultMXBeanMappingFactory.java:1021)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$CompositeMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:919)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$NonNullMXBeanMapping.fromOpenValue(DefaultMXBeanMappingFactory.java:133)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$ArrayMapping.fromNonNullOpenValue(DefaultMXBeanMappingFactory.java:584)
      at com.sun.jmx.mbeanserver.DefaultMXBeanMappingFactory$NonNullMXBeanMapping.fromOpenValue(DefaultMXBeanMappingFactory.java:133)
      at com.sun.jmx.mbeanserver.ConvertingMethod.fromOpenReturnValue(ConvertingMethod.java:131)
      at com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:168)
      at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:258)
      Caused: java.lang.reflect.UndeclaredThrowableException
      at com.sun.proxy.$Proxy16.dumpAllThreads(Unknown Source)

        Issue Links

          Activity

          Hide
          hb Harsha Wardhana B added a comment - - edited
          Test cases related to ThreadMXBean.dumpAllThreads() are all working fine. If you have a test case to reproduce the issue, please attach the same.

          Show
          hb Harsha Wardhana B added a comment - - edited Test cases related to ThreadMXBean.dumpAllThreads() are all working fine. If you have a test case to reproduce the issue, please attach the same.
          Hide
          thurka Tomáš Hůrka added a comment -
          So are you telling me that you have a test for ThreadMXBean.dumpAllThreads(), where JMX client runs on JDK 8 and JMX server runs on JDK 9 build 133 and such test passes?
          Show
          thurka Tomáš Hůrka added a comment - So are you telling me that you have a test for ThreadMXBean.dumpAllThreads(), where JMX client runs on JDK 8 and JMX server runs on JDK 9 build 133 and such test passes?
          Hide
          thurka Tomáš Hůrka added a comment -
          Problem is caused by two new attributes "moduleName" and "moduleVersion", which were added to StackTraceElementCompositeData by JDK-8142968. Unfortunately on JDK-8 side, ThreadInfoCompositeData.validateCompositeData() fails because LazyCompositeData.isTypeMatched() does not handle situation when CompositeType.getType(item) returns ArrayType. See attached patch for possible fix.
          Show
          thurka Tomáš Hůrka added a comment - Problem is caused by two new attributes "moduleName" and "moduleVersion", which were added to StackTraceElementCompositeData by JDK-8142968 . Unfortunately on JDK-8 side, ThreadInfoCompositeData.validateCompositeData() fails because LazyCompositeData.isTypeMatched() does not handle situation when CompositeType.getType(item) returns ArrayType. See attached patch for possible fix.
          Hide
          hb Harsha Wardhana B added a comment - - edited
          Sorry. Missed the part that client and server are on different version. Have you considered backporting https://bugs.openjdk.java.net/browse/JDK-8139870
          Show
          hb Harsha Wardhana B added a comment - - edited Sorry. Missed the part that client and server are on different version. Have you considered backporting https://bugs.openjdk.java.net/browse/JDK-8139870
          Hide
          thurka Tomáš Hůrka added a comment -
          I was not aware of JDK-8139870. It looks like the fix basically does the same as my patch. So I backporting JDK-8139870 to JDK 8 and JDK 7, should solve this issue. It is strange that this fix was not already backported.
          Show
          thurka Tomáš Hůrka added a comment - I was not aware of JDK-8139870 . It looks like the fix basically does the same as my patch. So I backporting JDK-8139870 to JDK 8 and JDK 7, should solve this issue. It is strange that this fix was not already backported.

            People

            • Assignee:
              Unassigned
              Reporter:
              thurka Tomáš Hůrka
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: