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/.
amarnah 2020-03-19T20:22:04.332100Z

Hello everyone! Recently I’ve been trying to compile a clojure project with graalvm, and I’ve been facing class initialization errors both on runtime and buildtime. I was wondering if anyone could help 😅

amarnah 2020-03-19T20:23:25.332200Z

Here’s my project.clj file

amarnah 2020-03-19T20:24:29.333Z

running the binary image shows a java.lang.ExceptionInInitializerError

amarnah 2020-03-19T20:25:26.333300Z

I got this

Original exception that caused the problem: org.graalvm.compiler.code.SourceStackTraceBailoutException$1: unbalanced monitors: mismatch at monitorexit, 3|LoadField#lockee__5436__auto__ != 96|LoadField#lockee__5436__auto__
when trying to compile the binary using verbose and printing error stacks

borkdude 2020-03-19T20:26:22.333600Z

@m.amarnah Can you try again with clojure 1.10.2-alpha1?

amarnah 2020-03-19T20:26:54.334100Z

I just tried with clojure 1.10.0 and it gave the same thing

borkdude 2020-03-19T20:27:03.334600Z

1.10.2-alpha1 specifically

amarnah 2020-03-19T20:27:17.335Z

sure thing

borkdude 2020-03-19T20:27:41.335600Z

the core team has made a fix for the mismatch monitorexit problem in that release

amarnah 2020-03-19T20:28:14.336100Z

oh okay, is that a problem that has to do with initializing/using thread pools?

borkdude 2020-03-19T20:29:19.336700Z

it has to do with the locking macro. if thread pools use that locking macro, then indirectly, potentially related

amarnah 2020-03-19T20:29:46.337Z

cool, cool

amarnah 2020-03-19T20:41:04.338300Z

So I think that fixed the mismatch monitorexit problem. It was showing Error: Unsupported features in 3 methods and now it says 2 methods instead of 3. The thing is down the stack trace I found this Caused by: <http://java.io|java.io>.FileNotFoundException: project.clj (No such file or directory)

amarnah 2020-03-19T20:41:53.338500Z

Here’s the stack trace

amarnah 2020-03-19T20:43:49.340400Z

Just a side note, I’m importing native java libraries in my clojure code. (:import [java.util.concurrent Executors ExecutorService TimeUnit]) although I tried importing that in a hello world project and it worked just fine.

borkdude 2020-03-19T20:53:17.340900Z

@m.amarnah why does your code try to load a project.clj file?

borkdude 2020-03-19T20:53:25.341100Z

do you have a link to the code itself?