[ 
https://issues.apache.org/jira/browse/CASSANDRA-18848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17764733#comment-17764733
 ] 

Ekaterina Dimitrova commented on CASSANDRA-18848:
-------------------------------------------------

5.0 Patch PR: https://github.com/apache/cassandra/pull/2683

5.0 JDK17 green CI run: 
https://app.circleci.com/pipelines/github/ekaterinadimitrova2/cassandra/2512/workflows/450638d5-873e-4257-824b-0db189236615

Also, tested locally and verified the debug log, no more exceptions are thrown. 
I believe we can safely propagate the patch to trunk and do only local check, 
saving on resources for full CI run.

I also used the opportunity to clean a few lines of dead code JDK8 related. 
TOTAL_CAPACITY had a different name in JDK8 so we were checking for that one in 
case we are on JDK8, but we dropped it already for 5.0+.

[~mck] , do. you mind to review this one? Seems like you worked on 
TOTAL_CAPACITY issue when we were upgrading to JDK11. 

 

> GCInspector "Error accessing field of java.nio.Bits" under java17
> -----------------------------------------------------------------
>
>                 Key: CASSANDRA-18848
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18848
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Observability/Metrics
>            Reporter: Ekaterina Dimitrova
>            Assignee: Ekaterina Dimitrova
>            Priority: Low
>             Fix For: 5.0.x, 5.x
>
>
> Running under java17, {{GCInspector}} throws the following exception:
> {noformat}
> 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 {noformat}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to