Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-36704

InaccessibleObjectException in Java 9+ on startup

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.2.0, 3.1.3, 3.0.4
    • Component/s: Spark Core
    • Labels:
      None

      Description

      A user reported this error on startup, which must be Java9+-related given the Java-9+ exception:

      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.nio.DirectByteBuffer(long,int) accessible: module java.base does not "opens java.nio" to unnamed module @71e9ddb4
              at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
              at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
              at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188)
              at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181)
              at org.apache.spark.unsafe.Platform.<clinit>(Platform.java:56)
      

      Code in this section tries to open up some access to DirectBuffer by reflection, which no longer works by default in Java 9+. We long ago tried to handle this by dealing with the exception and avoiding reflection where not possible. However this seems like a possible new way the same type of issue can manifest.

      We can shore up the code checking this to try to handle this apparent error path similarly.

        Attachments

          Activity

            People

            • Assignee:
              srowen Sean R. Owen
              Reporter:
              srowen Sean R. Owen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: