Lein uber jar hangs even though there are no blocking top level defs

I have two namespaces foo.core and foo.main. The foo.main namespace is just this

(ns foo.main
  (:require [foo.core :as core])
  (:gen-class))

(println "started main")

(defn -main [& args]
  (println "I am here"))

(println "finished main")

And the foo.core namespace contains mount states.

(ns foo.core)

(println "started core")

...
...
...

(println "finished core")

But when I run lein uberjar this is the output that I get and it hangs there.

Compiling foo.core
started core
finished core
Compiling foo.main
started main
finished main

If the evaluation has reached the end in both the namespaces that means there could be nothing that is blocking right? What could have gone wrong here?

https://clojure.org/guides/faq#agent_shutdown

It’s very likely you have top-level defs that are causing agents or thread pools to be created, and this is why you are experiencing a “hang” at the end of compilation.

2 Likes