Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

There is a race condition in cljs.analyzer/load-core.



(defn load-core []

 (when (not @-cljs-macros-loaded)
   (reset! -cljs-macros-loaded true)
   (if *cljs-macros-is-classpath*
     (locking load-mutex
       (load *cljs-macros-path*))
     (locking load-mutex
       (load-file *cljs-macros-path*))))
 (intern-macros 'cljs.core)))


When 2+ threads with independent * } bindings call {{load-core}} at the same time only one will trigger the actual load and the others will proceed directly to {{intern-macros}} and begin interning the macros into their compiler env. Since the load of the first thread may not yet be finished with loading the actual cljs.core macros the second thread will have an incomplete set of macros in its compiler env.

Related: https://dev.clojure.org/jira/browse/CLJS-1963

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CLJS-2381 (reported by thheller)