Does it shutdown if you do this before the exit?

(shutdown-agents)

On Thu, Apr 16, 2009 at 1:29 PM, Chas Emerick <cemer...@snowtide.com> wrote:
>
> I believe this is an issue related to how the threadpools used by
> executors are populated by default, i.e. they use non-daemon threads.
>
> clojure.lang.Agent uses instances of these default threadpool
> configurations, which is likely the cause of the delayed shutdown of
> the JVM (I'll bet that if you let the process linger for a couple
> minutes, the threadpools' timeouts will trip, the non-daemon threads
> will die, and the process will exit gracefully).
>
> The solution would be for clojure.lang.Agent to create
> ExecutorServices whose threadpools use a ThreadFactory that only
> creates daemon threads.  I don't really use agents though, so I'm not
> at all in a position to write or test that patch (or be aware of what
> other consequences might arise from having agents executing on daemon
> threads -- I presume there aren't any, but...).
>
> - Chas
>
> On Apr 16, 12:25 pm, Drew Raines <aarai...@gmail.com> wrote:
>> I have a command line utility that calls (exit 0) at the end of
>> (-main).  It looks like this:
>>
>>   (defn exit [status]
>>     (shutdown-agents)
>>     (flush)
>>     (System/exit status))
>>
>> Yet, despite this, the JVM never exits.  Here is a snippet of jstack
>> output:
>>
>> --8<---------------cut here---------------start------------->8---
>>   "DestroyJavaVM" prio=10 tid=0x00000000406c7c00 nid=0x445d waiting on 
>> condition [0x0000000000000000..0x0000000041e48d10]
>>      java.lang.Thread.State: RUNNABLE
>>
>>      Locked ownable synchronizers:
>>           - None
>>
>>   "pool-1-thread-10" prio=10 tid=0x00007fd9744fac00 nid=0x447c waiting on 
>> condition [0x0000000042e58000..0x0000000042e58da0]
>>      java.lang.Thread.State: WAITING (parking)
>>         at sun.misc.Unsafe.park(Native Method)
>>         - parking to wait for  <0x00007fd981140198> (a 
>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
>>         at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
>>         at 
>> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
>>         at 
>> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
>>         at 
>> java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
>>         at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>         at java.lang.Thread.run(Thread.java:619)
>> --8<---------------cut here---------------end--------------->8---
>>
>> What else can I try to force everything to shut down?
>>
>> Thanks!
>>
>> -Drew
>>
>>  jvm-hang.txt
>> 11KViewDownload
> >
>



-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to