Details
-
Bug
-
Status: Resolved
-
Low
-
Resolution: Fixed
-
5.0-alpha2, 5.0, 5.1
-
None
Description
Running under java17, GCInspector throws the following exception:
DEBUG [main] 2023-09-13 09:35:28,031 GCInspector.java:85 - Error accessing field of java.nio.Bits java.lang.reflect.InaccessibleObjectException: Unable to make field private static final java.util.concurrent.atomic.AtomicLong java.nio.Bits.TOTAL_CAPACITY accessible: module java.base does not "opens java.nio" to unnamed module @503d687a at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at org.apache.cassandra.service.GCInspector.<clinit>(GCInspector.java:80) at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:328) at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:729) at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:853) INFO [main] 2023-09-13 09:35:28,039 PaxosUncommittedTracker.java:236 - enabling PaxosUncommittedTracker
This is because GCInspector uses reflection to read the TOTAL_CAPACITY from java.nio.Bits. Access was restricted somewhere between 11 and 17.
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.