Fork me on GitHub
#leiningen
<
2020-05-15
>
Will21:05:35

running

lein uberjar
as part of our Azure Dev Ops CI/CD pipeline has been taking forever. It sometimes times out after 60 mins. If it does complete it takes at least 20. I'm not really sure how to even begin to diagnose (I'm new leiningen and Java in general). Running locally works fine. I did find that adding these jvm options to the project.clj file sped things up on my laptop. But they seem to have the opposite affect on our CI/CD pipeline.
:jvm-opts ["-Xms2g" "-Xmx2g" "-XX:-UseCompressedOops"]
the rest of our uberjar options look like:
{:uberjar {:omit-source true
             :aot :all
             :uberjar-name "<my-projects-name>.jar"
             :source-paths ["env/prod/clj"]
             :resource-paths ["env/prod/resources"]
             :jvm-opts ["-Xms2g" "-Xmx2g" "-XX:-UseCompressedOops"]}
(except we don't use those jvm-opts in the CI/CD pipeline) Could :aot :all be slowing things down? Does anyone have any thoughts or suggestions for how to further investigate? Thanks!

Alex Miller (Clojure team)21:05:32

if you set env var DEBUG to anything, lein will give you more output

noisesmith21:05:18

@wyeager the most common culprit of jar building taking forever is a side effect inside a def form that creates a thread or activates a resource

noisesmith21:05:37

or blocks forever and never activates the resource effectively....

noisesmith21:05:44

you can use a signal (also generated by Control-\ in a local terminal) to see what all your threads are trying to do, that's often enlightening in a stalled build

noisesmith21:05:31

$ kill -3 PID for the PID of the java process doing the uberjar

Will21:05:36

thanks guys! I'll give your suggestions a try!