graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
lvh 2020-05-03T03:33:38.220200Z

FYI I'm hitting: Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of http://java.io.FilePermission are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. Detailed message: Trace: Object was reached by reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant java.util.concurrent.ConcurrentHashMap$Node@12f4cf5d reached by indexing into array constant java.util.concurrent.ConcurrentHashMap$Node[]@2ac46e53 reached by reading field java.util.concurrent.ConcurrentHashMap.table of constant java.util.concurrent.ConcurrentHashMap@12f4cf5d reached by reading field http://java.io.FilePermissionCollection.perms of constant http://java.io.FilePermissionCollection@afc768e reached by reading field java.util.concurrent.ConcurrentHashMap$Node.val of constant java.util.concurrent.ConcurrentHashMap$Node@5e7666a1 reached by indexing into array constant java.util.concurrent.ConcurrentHashMap$Node[]@4b4549be reached by reading field java.util.concurrent.ConcurrentHashMap.table of constant java.util.concurrent.ConcurrentHashMap@5e7666a1 reached by reading field java.security.Permissions.permsMap of constant java.security.Permissions@773c8886 reached by reading field java.security.ProtectionDomain.permissions of constant java.security.ProtectionDomain@2f112965 reached by indexing into array constant java.security.ProtectionDomain[]@7374ce00 reached by reading field java.security.AccessControlContext.context of constant java.security.AccessControlContext@2f112965 reached by reading field http://java.net.URLClassLoader.acc of constant clojure.lang.DynamicClassLoader@1850c234 reached by reading field java.lang.Class.classLoader of constant java.lang.Class@18407f5c reached by Hub

lvh 2020-05-03T03:33:49.220500Z

which I can only find examples of via search to this channel

lvh 2020-05-03T03:34:07.220900Z

This is with 20.0.0 + jdk11, which unfortunately I need

lvh 2020-05-03T03:34:12.221100Z

(jdk11, that is)

lvh 2020-05-03T03:34:33.221400Z

https://github.com/latacora/wernicke master if anyone wants to try for themselves

lvh 2020-05-03T03:38:16.221800Z

looks like that's a fairly common jdk11 problem: https://github.com/BrunoBonacci/graalvm-clojure/search?q=java.io.FilePermission&unscoped_q=java.io.FilePermission

flowthing 2020-05-03T11:06:12.227Z

I'm working on something I want to compile to a native binary using GraalVM. I'm making somewhat heavy use of Java interop. To make the resulting binary work, I have to pepper my codebase with type hints. I can compile the binary (using clj.native-image) just fine, but when I neglect to add a type hint somewhere, the binary throws a type-related exception when I run it. The problem is that the feedback loop is pretty long: to detect any missing type hints, I first need to compile the native image (which can take quite long) and then run it. Is there any way to shorten the feedback loop? Is there an option I can pass to the native image compiler to make it report the type errors, for example? Or can I leverage *warn-on-reflection* somehow?

borkdude 2020-05-03T12:01:21.227700Z

@flowthing Yes, *warn-on-reflection* is what you want to enable everywhere you do Java interop

flowthing 2020-05-03T17:20:36.227800Z

Thanks! I do set it in my entry point namespace, but I guess I should set it in every namespace where I do Java interop. Will give it a try.

borkdude 2020-05-03T17:25:39.228Z

yes, every namespace

👀 1
flowthing 2020-05-03T17:26:00.228200Z

Gotcha. :thumbsup: