[ 
https://issues.apache.org/jira/browse/SSHD-931?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Goldstein Lyor resolved SSHD-931.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.3.1

Using a {{Supplier}} instead of an instance which allows for the following:
{code:java}
    CloseableExecutorService mySpecialExecutor = ...;
    SftpSubsystemFactory factory = new SftpSubsystemFactory.Builder()
        .withExecutorServiceProvider(() -> 
ThreadUtils.noClose(mySpecialExecutor))
        .build();
    server.setSubsystemFactories(Collections.singletonList(factory));
{code}

> SftpSubsystem.destroy() will terminate external FixedThreadPool 
> ExecutorService - preventing re-connects
> --------------------------------------------------------------------------------------------------------
>
>                 Key: SSHD-931
>                 URL: https://issues.apache.org/jira/browse/SSHD-931
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>         Environment: Linux RH
>            Reporter: Alla Gofman
>            Assignee: Goldstein Lyor
>            Priority: Major
>             Fix For: 2.3.1
>
>
> Similar bug from the 1.2.0 version
> https://issues.apache.org/jira/browse/SSHD-669
>  
> In SftpSubsystem on performing the destroy logic (on a client disconnect 
> f.e.), the code will also terminate the current executor service as well.
> [https://github.com/apache/mina-sshd/blob/master/sshd-sftp/src/main/java/org/apache/sshd/server/subsystem/sftp/SftpSubsystem.java#L1001]
>  *** There is no shutdownExecutor parameter in SftpSubsystem.
>  
> 2019-07-14 19:00:14,236 ERROR [sshd-FactoryExecutorService-thread-1] 
> (SftpSubsystem:316) - 
> run(ServerSessionImpl[user1@DOMAIN/137.72.216.21:50597]) InterruptedException 
> caught in SFTP subsystem: null
> 2019-07-14 19:00:14,236 DEBUG [sshd-FactoryExecutorService-thread-1] 
> (SftpSubsystem:319) - 
> run(ServerSessionImpl[us...@il-agofman-w2.adprod.bmc.com/137.72.216.21:50597])
>  caught exception details
> java.lang.InterruptedException: null
>  at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
>  ~[?:?]
>  at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
>  ~[?:?]
>  at 
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433) 
> ~[?:?]
>  at 
> org.apache.sshd.server.subsystem.sftp.SftpSubsystem.run(SftpSubsystem.java:304)
>  [sshd-sftp-2.2.0.jar!/:2.2.0]
>  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) 
> [?:?]
>  at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
>  at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>  [?:?]
>  at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>  [?:?]
>  at java.lang.Thread.run(Thread.java:834) [?:?]
> ----------------------------------------------------------------------------------------------------------------------
> Using protectExecutorServiceShutdown wrapper with shutdownOnExit = false will 
> not solve the problem due to another exception thrown from NoCloseExecutor by
> ValidateUtils.checkState(!isShutdown(), "Executor has been shut down");
> ***The second time !isShutdown() issues it will return true!!!
> [https://github.com/apache/mina-sshd/blob/master/sshd-common/src/main/java/org/apache/sshd/common/util/threads/NoCloseExecutor.java#L66]
> 2019-07-12 22:18:07,097 ERROR 
> [sshd-SshServer[3245efdb](port=1222)-nio2-thread-8] 
> (HubSftpSubsystemWrapper:274) - Failed (IllegalStateException) to start 
> command: java.lang.IllegalStateException: Executor has been shut down
> java.lang.IllegalStateException: Executor has been shut down
>  at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>  ~[sshd-common-2.2.0.jar!/:2.2.0]
>  at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalStateException(ValidateUtils.java:207)
>  ~[sshd-common-2.2.0.jar!/:2.2.0]
>  at 
> org.apache.sshd.common.util.ValidateUtils.checkState(ValidateUtils.java:184) 
> ~[sshd-common-2.2.0.jar!/:2.2.0]
>  at 
> org.apache.sshd.common.util.threads.NoCloseExecutor.submit(NoCloseExecutor.java:66)
>  ~[sshd-common-2.2.0.jar!/:2.2.0]
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to