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

Find a way to get FileDescriptor.fd and sun.nio.ch.FileChannelImpl.fd without opening internals

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Normal
    • Resolution: Unresolved
    • 5.x
    • Build
    • None
    • Semantic
    • Normal
    • All
    • None

    Description

      With Java 17 if we do not add below to the jvm17 server options:

      --add-opens java.base/sun.nio.ch=ALL-UNNAMED
      --add-opens java.base/java.io=ALL-UNNAMED

      we get on startup (considering I comment out the scripted UDFs and apply a few changes to the startup scripts):

      ERROR [ScheduledTasks:1] 2022-08-23 12:29:25,652 JVMStabilityInspector.java:68 - Exception in thread Thread[ScheduledTasks:1,5,ScheduledTasks]
      java.lang.AssertionError: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @11d8ae8b
      at org.apache.cassandra.utils.FBUtilities.getProtectedField(FBUtilities.java:801)
      at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:84)
      at org.apache.cassandra.utils.TimeUUID$Generator.hash(TimeUUID.java:496)
      at org.apache.cassandra.utils.TimeUUID$Generator.makeNode(TimeUUID.java:474)
      at org.apache.cassandra.utils.TimeUUID$Generator.makeClockSeqAndNode(TimeUUID.java:452)
      at org.apache.cassandra.utils.TimeUUID$Generator.<clinit>(TimeUUID.java:368)
      at org.apache.cassandra.streaming.StreamingState.<clinit>(StreamingState.java:50)
      at org.apache.cassandra.streaming.StreamManager.<init>(StreamManager.java:257)
      at org.apache.cassandra.streaming.StreamManager.<clinit>(StreamManager.java:58)
      at org.apache.cassandra.service.StorageService.<init>(StorageService.java:376)
      at org.apache.cassandra.service.StorageService.<clinit>(StorageService.java:226)
      at org.apache.cassandra.locator.DynamicEndpointSnitch.updateScores(DynamicEndpointSnitch.java:274)
      at org.apache.cassandra.locator.DynamicEndpointSnitch$1.run(DynamicEndpointSnitch.java:91)
      at org.apache.cassandra.concurrent.ExecutionFailure$1.run(ExecutionFailure.java:133)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
      at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
      at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @11d8ae8b
      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.utils.FBUtilities.getProtectedField(FBUtilities.java:796)
      ... 20 common frames omitted
      

      and 

      ERROR [ScheduledTasks:1] 2022-08-23 12:31:18,443 JVMStabilityInspector.java:68 - Exception in thread Thread[ScheduledTasks:1,5,ScheduledTasks]
      java.lang.AssertionError: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.io.FileDescriptor sun.nio.ch.FileChannelImpl.fd accessible: module java.base does not "opens sun.nio.ch" to unnamed module @4c012563
      at org.apache.cassandra.utils.FBUtilities.getProtectedField(FBUtilities.java:801)
      at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:87)
      at org.apache.cassandra.utils.TimeUUID$Generator.hash(TimeUUID.java:496)
      at org.apache.cassandra.utils.TimeUUID$Generator.makeNode(TimeUUID.java:474)
      at org.apache.cassandra.utils.TimeUUID$Generator.makeClockSeqAndNode(TimeUUID.java:452)
      at org.apache.cassandra.utils.TimeUUID$Generator.<clinit>(TimeUUID.java:368)
      at org.apache.cassandra.streaming.StreamingState.<clinit>(StreamingState.java:50)
      at org.apache.cassandra.streaming.StreamManager.<init>(StreamManager.java:257)
      at org.apache.cassandra.streaming.StreamManager.<clinit>(StreamManager.java:58)
      at org.apache.cassandra.service.StorageService.<init>(StorageService.java:376)
      at org.apache.cassandra.service.StorageService.<clinit>(StorageService.java:226)
      at org.apache.cassandra.locator.DynamicEndpointSnitch.updateScores(DynamicEndpointSnitch.java:274)
      at org.apache.cassandra.locator.DynamicEndpointSnitch$1.run(DynamicEndpointSnitch.java:91)
      at org.apache.cassandra.concurrent.ExecutionFailure$1.run(ExecutionFailure.java:133)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
      at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
      at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.io.FileDescriptor sun.nio.ch.FileChannelImpl.fd accessible: module java.base does not "opens sun.nio.ch" to unnamed module @4c012563
      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.utils.FBUtilities.getProtectedField(FBUtilities.java:796)
      ... 20 common frames omitted
      

       

      EDIT: 

      Also adding 

      --add-opens java.base/java.nio=ALL-UNNAMED

      to prevent below error on startup with JDK17:

      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.io.FileDescriptor java.nio.MappedByteBuffer.fd accessible: module java.base does not "opens java.nio" to unnamed module @934b6cb
      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.utils.SyncUtil.<clinit>(SyncUtil.java:58)
      ... 29 common frames omitted
      

      CASSANDRA-17909 handled this one

       

      Attachments

        Issue Links

          Activity

            People

              blerer Benjamin Lerer
              e.dimitrova Ekaterina Dimitrova
              Benjamin Lerer
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: