Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-14757

GCInspector "Error accessing field of java.nio.Bits" under java11

    XMLWordPrintableJSON

Details

    Description

      Running under java11, GCInspector throws the following exception:

      DEBUG [main] 2018-09-18 05:18:25,905 GCInspector.java:78 - Error accessing field of java.nio.Bits
      java.lang.NoSuchFieldException: totalCapacity
              at java.base/java.lang.Class.getDeclaredField(Class.java:2412)
              at org.apache.cassandra.service.GCInspector.<clinit>(GCInspector.java:72)
              at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:308)
              at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:590)
              at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:679)
      

      This is because GCInspector uses reflection to read the totalCapacity from java.nio.Bits. This field was renamed to TOTAL_CAPACITY somewhere between java8 and java11.

      Note: this is a rather harmless error, as we only look at Bits.totalCapacity for metrics collection on how much direct memory is being used by {{ByteBuffer}}s. If we fail to read the field, we simply return -1 for the metric value.

      Attachments

        Issue Links

          Activity

            People

              snazy Robert Stupp
              jasobrown Jason Brown
              Michael Semb Wever
              Robert Stupp
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m