After ARROW-3191 [1], consumers of Arrow Java with a JDK 9 and above are
required to set the JVM property "io.netty.tryReflectionSetAccessible=true"
at startup, each time Arrow code is run, as documented at [2]. Not doing
this will result in the error "java.lang.UnsupportedOperationException:
sun.misc.Unsafe or java.nio.DirectByteBuffer.(long, int) not available".
This is due to a part of the Netty codebase, and I'm not sure if there any
way around it, but I don't think it's the correct behavior for Arrow
out-of-the-box to fail with a 3rd party error by default. This has come up
before in our own unit testing [3], and most recently when upgrading Arrow
in Spark [4].

I'd like to propose that Arrow Java change to the following behavior:

1) check to see if the property io.netty.tryReflectionSetAccessible has
been set
2) if not set, automatically set to "true"
3) else if set to "false", catch the Netty error and prepend the error
message with the suggested setting of "true"

What do other devs think?

[1] https://issues.apache.org/jira/browse/ARROW-3191
[2] https://github.com/apache/arrow/tree/master/java#java-properties
[3] https://issues.apache.org/jira/browse/ARROW-5412
[4] https://github.com/apache/spark/pull/26552

Reply via email to