Chris Janicki created SSHD-225:
----------------------------------

             Summary: A non-deamon thread pool prevents graceful JVM exit
                 Key: SSHD-225
                 URL: https://issues.apache.org/jira/browse/SSHD-225
             Project: MINA SSHD
          Issue Type: Bug
    Affects Versions: 0.8.0
         Environment: Apple Java v. 1.6.0
            Reporter: Chris Janicki


When embedded in my app, the following SSHD thread remains running and prevents 
my app from exiting gracefully (by allowing the JVM to automatically shutdown 
when only deamon threads remain).  I call sshd.stop(true), but this thread 
still remains.  Note however, than it seems to die itself after several minutes 
(10+).  Then my app successfully exits.  

"pool-6-thread-1" prio=5 tid=102821800 nid=0x10e941000 waiting on condition 
[10e940000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <7eedb8190> (a 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
        at 
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
        at 
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:957)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:917)
        at java.lang.Thread.run(Thread.java:680)


I tried the following to replace the executor's ThreadFactory with my own 
(this) that calls setDaemon(true) on the generated thread, but that didn't work 
for some reason… The thread in the dump was still not marked daemon, so maybe 
I'm looking at the wrong area.

                ScheduledExecutorService executor = 
Executors.newSingleThreadScheduledExecutor(this);
                sshd.setScheduledExecutorService(executor, true);


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to