|compileClojure task hangs||Dave Ray||12/15/12 9:09 PM|
One problem I've had with Clojuresque is that the compileClojure task
hangs for our codebase. Luckily, I think I have a solution.
Here's what I believe the compile task does:
* spawns off a JVM (maybe gradle does this) and runs the compile.clj
task (through the Driver.java shim)
* compile.clj just runs through all the clj source files and requires them
That's it. The issue is that some of our code refers to Java classes
whose static initializers do non-trivial stuff like, say, starting up
non-daemon background threads. So all the code is required, the task
returns, and then the JVM never exits because there are these stupid
non-daemon threads hanging around. I might be able to track down
whoever's creating these threads and get them to change, but it will
always be a risk since stuff like this won't happen with pure Java
My current solution is just to put an explicit (System/exit 0) at the
end of the compile task. This seems to work fine and seems like it
shouldn't have any impact on the semantics of the task. Putting
System.exit(0) at the end of main() in Driver.java would fix the same
issue for all tasks. I see the same behavior with clojureTest.
|AW: compileClojure task hangs||Meikel Brandmeyer||12/16/12 12:16 PM|
sorry. Only mobile connection at the moment.
Adding System/exit is the only solution I can spontaneously think off. Not requiring the namespaces won't help. Same problem when switching to AOT.
Durch MOTOBLUR™ verbunden
|Re: compileClojure task hangs||Dave Ray||12/16/12 1:15 PM|
I'm working around it at the moment by just copying and modifying
compile.clj and test.clj and putting them earlier in the classpath.
I'll create an issue on bitbucket to track.