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

REGRESSION: Contents of GarbageCollectorMXBean's LastGcInfo attribute are incorrect

    Details

      Description

      Since the java.lang.management MXBeans have been switched over to using the generic MXBean framework, a problem has come to light with the GarbageCollectorMXBean. This MXBean has a Hotspot-specific extension that defines an attribute "LastGcInfo" of type GcInfo. The GcInfo class implements CompositeData, and the Tiger MXBean framework used to interpret this as meaning that it should be mapped into itself (as a CompositeData). Hotspot added additional fields to the CompositeData in question, reflecting gc-type-specific information.

      The Mustang MXBean framework does not have a special case for a class implementing CompositeData, because it defines the OpenType of all mapped types, and it would not be apparent what the OpenType for GcInfo would be. Therefore it translates GcInfo naively, not including the extra fields that were present in Tiger, but erroneously including a field called "compositeType" implied by the method CompositeData.getCompositeType().

      The attached test program shows the difference in behaviour. In Tiger, the output begins like this:

      CompositeType {
          GcThreadCount: javax.management.openmbean.SimpleType(name=java.lang.Integer)
          endTime: javax.management.openmbean.SimpleType(name=java.lang.Long)
          id: javax.management.openmbean.SimpleType(name=java.lang.Long)
          memoryUsageAfterGc: TabularType[key]: CompositeType {

      In Mustang, it begins like this:

      CompositeType {
          compositeType: CompositeType {
              array: javax.management.openmbean.SimpleType(name=java.lang.Boolean)
              className: javax.management.openmbean.SimpleType(name=java.lang.String)
              description: javax.management.openmbean.SimpleType(name=java.lang.String)
              typeName: javax.management.openmbean.SimpleType(name=java.lang.String)
          }
          duration: javax.management.openmbean.SimpleType(name=java.lang.Long)
          endTime: javax.management.openmbean.SimpleType(name=java.lang.Long)
          id: javax.management.openmbean.SimpleType(name=java.lang.Long)
          memoryUsageAfterGc: TabularType[key]: CompositeType {

      Notice that the GcThreadCount field has disappeared, whereas a bogus "compositeType" field has appeared. (Also the "duration" field which was specified in Tiger was not actually present there, which is a bug, though an unimportant once since the value is redundantly equal to endTime - startTime.)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emcmanus Eamonn McManus
                Reporter:
                emcmanus Eamonn McManus
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: