[
https://issues.apache.org/jira/browse/SSHD-851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653640#comment-16653640
]
Roberto Deandrea commented on SSHD-851:
---------------------------------------
I guess that the problem is originated from changes made in
Nio2Sesion.doCloseGracefully() for issue SSHD-85.
>From old code:
_@Override_
_protected CloseFuture doCloseGracefully() {_
_return builder().when(writes).build().close(false);_
_}_
To new code:
_@Override_
_protected CloseFuture doCloseGracefully() {_
_return builder().when(writes).run(() -> {_
_try {_
_AsynchronousSocketChannel socket = getSocket();_
_socket.shutdownOutput();_
_} catch (IOException e) {_
_log.info("doCloseGracefully({}) {} while shutting down output:
{}",_
_this, e.getClass().getSimpleName(), e.getMessage());_
_}_
_}).build().close(false);_
_}_
> Last chunk of data lost into local port forwarding channel
> ----------------------------------------------------------
>
> Key: SSHD-851
> URL: https://issues.apache.org/jira/browse/SSHD-851
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.1.1
> Reporter: Roberto Deandrea
> Priority: Major
> Attachments: sshd.agent.trace
>
>
> Hi Lyor,
> I found another problem transferring data through a local port forwarding
> channel.
> It seems that the problem is located into Apache SSHD server code according
> to me.
> All the data are transferred from the originating client to the Apache SSH
> client and then go to the SSHD server through a local port forwarding channel.
> When the client stops sending data, and the channel is being closed, the
> SSHD server fail to send the last chunk of data to the target destination.
> In the attached trace file the problem is isolated as the following:
> *local port forwarding channel : [id=732 recipient=732]*
> *Nio2Session[local=/0:0:0:0:0:0:0:0:50047, remote=/192.168.2.107:62284
> session against target server*
> Looking through the traces I see that when the local port forwarding channel
> is closed, the Nio2Session against the target server is closed gracefully,
> but instead of waiting to complete pending socket writes to the target server
> the Nio2Session is then closed immediately causing write failures.
> In the traces I see:
> 2018-10-16 16:20:19,167 DEBUG [xdmzdriverssh@/192.168.10.34:55335]]-thread-1]
> [AbstractCloseable.close] close(Nio2Session[local=/0:0:0:0:0:0:0:0:50047,
> remote=/192.168.2.107:62284]) Closing gracefully
> 2018-10-16 16:20:19,167 DEBUG [xdmzdriverssh@/192.168.10.34:55335]]-thread-2]
> [AbstractCloseable.close]
> close(org.apache.sshd.common.io.nio2.Nio2Connector@77fcff14) Closing
> immediately^M
> 2018-10-16 16:20:19,167 DEBUG [xdmzdriverssh@/192.168.10.34:55335]]-thread-2]
> [AbstractCloseable.close] close(Nio2Session[local=/0:0:0:0:0:0:0:0:50047,
> remote=/192.168.2.107:62284]) Closing immediately
> After that I see:
> 2018-10-16 16:20:19,167 DEBUG [xdmzdriverssh@/192.168.10.34:55335]]-thread-2]
> [Nio2Session.doCloseImmediately]
> doCloseImmediately(Nio2Session[local=/0:0:0:0:0:0:0:0:50047,
> remote=/192.168.2.107:62284]) signal write abort for
> future=Nio2DefaultIoWriteFuture[id=/192.168.2.107:62284][value=null]
> 2018-10-16 16:20:19,167 DEBUG [xdmzdriverssh@/192.168.10.34:55335]]-thread-2]
> [TcpipServerChannel.handleWriteDataFailure]
> handleWriteDataFailure(TcpipServerChannel[id=732,
> recipient=732]-ServerSessionImpl[aixdmzdriverssh@/192.168.10.34:55335])[SSH_MSG_CHANNEL_DATA]
> failed (WriteAbortedException) to write len=16384: Write request aborted due
> to immediate session close
>
> These errors are repeated multiple times.
> The sum of bytes not written are equal to the chunk of data missing ad the
> target server.
> Can you troubleshoot this problem?
> Let me know if you need more info.
>
> Cheers
> Roberto
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)