The ClojureScript compiler build functionality does not use future, clojure.java.shell/sh or pmap internally.
This is an upstream Closure Compiler bug. David On Wed, Mar 18, 2015 at 2:50 PM, Andy Fingerhut <[email protected]> wrote: > The symptoms and workaround you describe sound like the ClojureScript > compiler is using future, clojure.java.shell/sh, or pmap somewhere > internally. > > Besides the workaround of doing (System/exit 0) near the end, you should > also be able to call (shutdown-agents) > > You can also vote on this Clojure JIRA ticket if you'd like to see the > issue addressed in Clojure: http://dev.clojure.org/jira/browse/CLJ-124 > > This is also documented on ClojureDocs.org here: > http://clojuredocs.org/clojure.core/future > > Andy > > On Wed, Mar 18, 2015 at 9:48 AM, Caspar Hasenclever <[email protected] > > wrote: > >> Following the current Quick Start document at >> https://github.com/clojure/clojurescript/wiki/Quick-Start, I found that >> there is a roughly one minute long extra wait after closure optimizations >> have been applied before the JVM exits. >> >> My setup: hello word example as on the Quick Start guide, build.clj is: >> >> (require 'cljs.closure) >> >> (cljs.closure/build "src" >> {:output-to "out/main.js" >> :verbose true}) >> >> With this build call (no optimizations), compile from cold is under 3s. >> Adding simple optimizations to the above call: >> >> (cljs.closure/build "src" >> {:output-to "out/main.js" >> :optimizations :simple >> :verbose true}) >> >> makes the process take over a minute. The CPU is only active for a few >> seconds at the beginning, for the remainder of the time nothing appears >> to be happening (the output file is done and remains unchanged after the >> first few seconds). Looking at the process in jvisualvm shows threads >> called jscompiler that are also idle after a bit of activity at the >> beginning. My suspicion is that there is a timeout somewhere but I have >> not found exactly where. It looks as if it is in Google Closure as I >> can't find >> any reference to threads called jscompiler in the ClojureScript sources. >> >> A Thread dump during the wait time shows a jscompiler thread to be >> waiting: >> >> "jscompiler" #16 prio=5 os_prio=0 tid=0x00007f2304efb800 nid=0x5032 >> waiting on condition [0x00007f22e4713000] >> java.lang.Thread.State: TIMED_WAITING (parking) >> at sun.misc.Unsafe.park(Native Method) >> - parking to wait for <0x000000008725e6f8> (a >> java.util.concurrent.SynchronousQueue$TransferStack) >> at >> java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) >> at >> java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) >> at >> java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362) >> at >> java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:941) >> at >> java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066) >> at >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) >> at java.lang.Thread.run(Thread.java:745) >> >> Locked ownable synchronizers: >> - None >> >> Adding a simple: >> >> (System/exit 0) >> >> after the cljs.closure/build call reduces compilation by almost exactly >> a minute back down to 8 seconds with {:optimizations :simple}. >> >> System is Debian Linux (testing), Oracle JDK 8, java -version: >> >> java version "1.8.0_40" >> Java(TM) SE Runtime Environment (build 1.8.0_40-b26) >> Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode) >> >> Compilation command line is: >> >> java -cp cljs.jar:src clojure.main build.clj >> >> Has anybody else experienced this? Is there a way to reduce the wait? >> >> Regards, >> >> Caspar >> >> -- >> Note that posts from new members are moderated - please be patient with >> your first post. >> --- >> You received this message because you are subscribed to the Google Groups >> "ClojureScript" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/clojurescript. >> > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
