Fork me on GitHub
#graalvm
<
2020-03-19
>
amarnah20:03:04

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 😅

amarnah20:03:25

Here’s my project.clj file

amarnah20:03:29

running the binary image shows a java.lang.ExceptionInInitializerError

amarnah20:03:26

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

borkdude20:03:22

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

amarnah20:03:54

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

borkdude20:03:03

1.10.2-alpha1 specifically

amarnah20:03:17

sure thing

borkdude20:03:41

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

amarnah20:03:14

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

borkdude20:03:19

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

amarnah20:03:46

cool, cool

amarnah20:03:04

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: .FileNotFoundException: project.clj (No such file or directory)

amarnah20:03:53

Here’s the stack trace

amarnah20:03:49

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.

borkdude20:03:17

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

borkdude20:03:25

do you have a link to the code itself?