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

Evgeny Pasynkov updated SSHD-1289:
----------------------------------
    Description: 
{code}
   java.lang.Thread.State: WAITING
        at java.base@11.0.5/jdk.internal.misc.Unsafe.park(Native Method)
                -  waiting on 
java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@c50d1b2
        at 
java.base@11.0.5/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
        at 
java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:885)
        at 
java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:917)
        at 
java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1240)
        at 
java.base@11.0.5/java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:959)
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.updateState(KeyExchangeMessageHandler.java:139)
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.shutdown(KeyExchangeMessageHandler.java:186)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.preClose(AbstractSession.java:967)
        at 
org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:94)
        at 
org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.sessionClosed(AbstractSessionIoHandler.java:46)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.doCloseImmediately(Nio2Session.java:283)
        at 
org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:95)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.exceptionCaught(Nio2Session.java:215)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.writeBuffer(Nio2Session.java:186)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:1118)
        -  locked java.lang.Object@3423f353
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writeOrEnqueue(KeyExchangeMessageHandler.java:285)
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writePacket(KeyExchangeMessageHandler.java:228)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.writePacket(AbstractSession.java:1039)
        at org.apache.sshd.common.session.Session.writePacket(Session.java:159)
        at org.apache.sshd.common.session.Session.writePacket(Session.java:145)
        at 
org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable.close(AbstractChannel.java:637)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
        at 
org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
        at 
org.apache.sshd.common.future.AbstractSshFuture.lambda$notifyListener$2(AbstractSshFuture.java:162)
        at 
org.apache.sshd.common.future.AbstractSshFuture$$Lambda$352/0x0000000800890040.call(Unknown
 Source)
        at 
org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:66)
        at 
org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:161)
        at 
org.apache.sshd.common.future.DefaultSshFuture.addListener(DefaultSshFuture.java:166)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:57)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
        at 
org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
        at 
org.apache.sshd.common.util.closeable.AbstractInnerCloseable.doCloseGracefully(AbstractInnerCloseable.java:41)
        at 
org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:110)
        at 
org.apache.sshd.server.channel.ChannelSession.closeShell(ChannelSession.java:916)
        at 
org.apache.sshd.server.channel.ChannelSession.lambda$prepareCommand$0(ChannelSession.java:779)
        at 
org.apache.sshd.server.channel.ChannelSession$$Lambda$414/0x00000008008fa440.onExit(Unknown
 Source)
{code}

The lock is acquired in "KeyExchangeMessageHandler.writeOrEnqueue" and then 
tries to re-acquire in "KeyExchangeMessageHandler.updateState"


  was:

{code}
   java.lang.Thread.State: WAITING
        at java.base@11.0.5/jdk.internal.misc.Unsafe.park(Native Method)
                -  waiting on 
java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@c50d1b2
        at 
java.base@11.0.5/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
        at 
java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:885)
        at 
java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:917)
        at 
java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1240)
        at 
java.base@11.0.5/java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:959)
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.updateState(KeyExchangeMessageHandler.java:139)
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.shutdown(KeyExchangeMessageHandler.java:186)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.preClose(AbstractSession.java:967)
        at 
org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:94)
        at 
org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.sessionClosed(AbstractSessionIoHandler.java:46)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.doCloseImmediately(Nio2Session.java:283)
        at 
org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:95)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.exceptionCaught(Nio2Session.java:215)
        at 
org.apache.sshd.common.io.nio2.Nio2Session.writeBuffer(Nio2Session.java:186)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:1118)
        -  locked java.lang.Object@3423f353
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writeOrEnqueue(KeyExchangeMessageHandler.java:285)
        at 
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writePacket(KeyExchangeMessageHandler.java:228)
        at 
org.apache.sshd.common.session.helpers.AbstractSession.writePacket(AbstractSession.java:1039)
        at org.apache.sshd.common.session.Session.writePacket(Session.java:159)
        at org.apache.sshd.common.session.Session.writePacket(Session.java:145)
        at 
org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable.close(AbstractChannel.java:637)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
        at 
org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
        at 
org.apache.sshd.common.future.AbstractSshFuture.lambda$notifyListener$2(AbstractSshFuture.java:162)
        at 
org.apache.sshd.common.future.AbstractSshFuture$$Lambda$352/0x0000000800890040.call(Unknown
 Source)
        at 
org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:66)
        at 
org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:161)
        at 
org.apache.sshd.common.future.DefaultSshFuture.addListener(DefaultSshFuture.java:166)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:57)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
        at 
org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
        at 
org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
        at 
org.apache.sshd.common.util.closeable.AbstractInnerCloseable.doCloseGracefully(AbstractInnerCloseable.java:41)
        at 
org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:110)
        at 
org.apache.sshd.server.channel.ChannelSession.closeShell(ChannelSession.java:916)
        at 
org.apache.sshd.server.channel.ChannelSession.lambda$prepareCommand$0(ChannelSession.java:779)
        at 
org.apache.sshd.server.channel.ChannelSession$$Lambda$414/0x00000008008fa440.onExit(Unknown
 Source)

{code}



> Deadlock during session exit
> ----------------------------
>
>                 Key: SSHD-1289
>                 URL: https://issues.apache.org/jira/browse/SSHD-1289
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.9.0
>            Reporter: Evgeny Pasynkov
>            Priority: Major
>
> {code}
>    java.lang.Thread.State: WAITING
>       at java.base@11.0.5/jdk.internal.misc.Unsafe.park(Native Method)
>               -  waiting on 
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@c50d1b2
>       at 
> java.base@11.0.5/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
>       at 
> java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:885)
>       at 
> java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:917)
>       at 
> java.base@11.0.5/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1240)
>       at 
> java.base@11.0.5/java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:959)
>       at 
> org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.updateState(KeyExchangeMessageHandler.java:139)
>       at 
> org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.shutdown(KeyExchangeMessageHandler.java:186)
>       at 
> org.apache.sshd.common.session.helpers.AbstractSession.preClose(AbstractSession.java:967)
>       at 
> org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:94)
>       at 
> org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.sessionClosed(AbstractSessionIoHandler.java:46)
>       at 
> org.apache.sshd.common.io.nio2.Nio2Session.doCloseImmediately(Nio2Session.java:283)
>       at 
> org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:95)
>       at 
> org.apache.sshd.common.io.nio2.Nio2Session.exceptionCaught(Nio2Session.java:215)
>       at 
> org.apache.sshd.common.io.nio2.Nio2Session.writeBuffer(Nio2Session.java:186)
>       at 
> org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:1118)
>       -  locked java.lang.Object@3423f353
>       at 
> org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writeOrEnqueue(KeyExchangeMessageHandler.java:285)
>       at 
> org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writePacket(KeyExchangeMessageHandler.java:228)
>       at 
> org.apache.sshd.common.session.helpers.AbstractSession.writePacket(AbstractSession.java:1039)
>       at org.apache.sshd.common.session.Session.writePacket(Session.java:159)
>       at org.apache.sshd.common.session.Session.writePacket(Session.java:145)
>       at 
> org.apache.sshd.common.channel.AbstractChannel$GracefulChannelCloseable.close(AbstractChannel.java:637)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
>       at 
> org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:56)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
>       at 
> org.apache.sshd.common.future.AbstractSshFuture.lambda$notifyListener$2(AbstractSshFuture.java:162)
>       at 
> org.apache.sshd.common.future.AbstractSshFuture$$Lambda$352/0x0000000800890040.call(Unknown
>  Source)
>       at 
> org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:66)
>       at 
> org.apache.sshd.common.future.AbstractSshFuture.notifyListener(AbstractSshFuture.java:161)
>       at 
> org.apache.sshd.common.future.DefaultSshFuture.addListener(DefaultSshFuture.java:166)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:57)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable$1.operationComplete(SequentialCloseable.java:45)
>       at 
> org.apache.sshd.common.util.closeable.SequentialCloseable.doClose(SequentialCloseable.java:69)
>       at 
> org.apache.sshd.common.util.closeable.SimpleCloseable.close(SimpleCloseable.java:63)
>       at 
> org.apache.sshd.common.util.closeable.AbstractInnerCloseable.doCloseGracefully(AbstractInnerCloseable.java:41)
>       at 
> org.apache.sshd.common.util.closeable.AbstractCloseable.close(AbstractCloseable.java:110)
>       at 
> org.apache.sshd.server.channel.ChannelSession.closeShell(ChannelSession.java:916)
>       at 
> org.apache.sshd.server.channel.ChannelSession.lambda$prepareCommand$0(ChannelSession.java:779)
>       at 
> org.apache.sshd.server.channel.ChannelSession$$Lambda$414/0x00000008008fa440.onExit(Unknown
>  Source)
> {code}
> The lock is acquired in "KeyExchangeMessageHandler.writeOrEnqueue" and then 
> tries to re-acquire in "KeyExchangeMessageHandler.updateState"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to