Ha! Almost nine years later, a Google search surfaced this thread in response to "java jvm hang exit DestroyJavaVM thread." I have a Clojure based web crawler built around pegasus (and thus, both threadpool agents and clojure core async agents) that uses a command line interface to crawl in a subprocess for a few minutes at a time. The subprocess was randomly stubbornly not exiting after I shut down pegasus, and now I understand why. Adding a System/exit call made all the difference. Thanks!
On Wednesday, May 27, 2009 at 8:17:08 PM UTC-5, Timothy Pratley wrote: > > Hi Drew, > > I've been trying to recreate your issue.... > (defn forever[x] (while true (Thread/sleep 100) (print \-) (flush))) > (let [a (agent 0)] (send (agent 0) forever)) > (println (Thread/activeCount) "threads active") > (shutdown-agents) > (println "I'm here") > ;(System/exit 0) > > Notably shutdown-agents is a non-blocking call, and without the exit > the program runs forever. > With the exit, for me the program terminates - but I believe this is > where the behavior which may vary... > something different occurring in your environment to mine - shutodown > hooks? JVM? > My only other stab in the dark is could your (flush) actually block > before System/exit is called? > > Can you try my example and see if it hangs for you, and/or if there > some code you can paste that hangs? > > Regards, > Tim. > > > > On May 28, 6:08 am, Drew Raines <aarai...@gmail.com> wrote: > > billh04 wrote: > > > I think you are responsible for ending the currently running > > > agents. The usual method is to set up some field which the agents > > > monitor looking for some value indicating the application is > > > ending. > > > > By "ending currently running agents" do you mean the action run on > > the agent? My problem doesn't seem to be action-related because when > > I take out the agents and execute the same code synchronously, the > > JVM exits as I expect. > > > > For the record, I was able to consistently hang the JVM indefinitely > > from the command line in addition to invocation from cron, contrary > > to my claim in my other message. I suspect that others are not > > seeing any issues because most Java environments are persistent. > > Anyone else scripting with Clojure using agents? > > > > Thanks. > > > > -Drew -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.