Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to and GraalVM slack:
borkdude 2020-12-31T19:29:02.259400Z

Hmm, I'm running into a locking issue with clojure 1.10-rc2 and GraalVM 20.3.0. Repro code:

(ns pod.babashka.lock

(def ^:private hosts-file
  "Something to lock to tray and prevent concurrent updates/reads to
  hosts file."

(defn -main [& _args]
  (locking hosts-file
    (prn (+ 1 2 3))))
GraalVM native-image output:
Caused by: Frame states being merged are incompatible: unbalanced monitors - locked objects do not match
 This frame state: [locals: [1,5,_,_] stack: [9] locks: [] rethrowException]
Other frame state: [locals: [1,5,_,_] stack: [23] locks: [16 / 7] rethrowException]
Parser context: pod.babashka.lock$_main.invokeStatic(lock.clj:11) [bci: 17, intrinsic: false]
  17: checkcast     #26         // clojure.lang.IFn
  20: lconst_1
  21: ldc2_w        #27         // 2
  24: invokestatic  #4          // clojure.lang.Numbers.add:(long, long)long
  27: ldc2_w        #35         // 3

borkdude 2020-12-31T19:34:11.260200Z

This does seem to work:

(defn -main [& _args]
  (let [x (Object.)]
    (locking x
      (prn (+ 1 2 3)))))

borkdude 2020-12-31T19:40:16.260700Z

This may be false alarm because when I macroexpand I think I'm seeing the old locking macro code.

borkdude 2020-12-31T19:40:54.261300Z

although 1.10.2-rc2 should be used according to -Stree and such

ghadi 2020-12-31T19:41:40.261700Z

1.10.2-rc2 doesn't exist, only 1.10.2-rc1

borkdude 2020-12-31T19:42:07.262500Z

yeah sorry, typo. Gosh, it seems depstar isn't picking up rc1 even when I include that in my aliases

borkdude 2020-12-31T19:42:24.262900Z

when I print the clojure version at compile time I get 1.10.1

ghadi 2020-12-31T19:42:40.263200Z

perhaps depstar is confused?

borkdude 2020-12-31T19:43:09.263600Z

I think depstar now has a new :aliases arg

borkdude 2020-12-31T19:43:26.264Z

:aliases '[:webassets]'

borkdude 2020-12-31T19:43:36.264400Z

so probably I was confused

borkdude 2020-12-31T19:45:17.264600Z

all good now, sorry for the noise and happy new year!