You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Goldstein Lyor (JIRA)" <ji...@apache.org> on 2018/01/25 17:13:00 UTC

[jira] [Commented] (SSHD-795) IOException (Broken pipe) on a socket local forwarding channel causes SSH client-server connection down

    [ https://issues.apache.org/jira/browse/SSHD-795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16339515#comment-16339515 ] 

Goldstein Lyor commented on SSHD-795:
-------------------------------------

I am not sure I understand exactly what you mean by

{quote}
I'm not convinced this is the right behavior. I think it is not necessary to bring down SSH client server connection because this is not a protocol violation, but a socket problem related to forwarded remote server connection.
{quote}

In any case, the forwarding channel simply mimics the behavior of a "real" connection - the one being tunneled through SSH. If the peer has reset the connection or closed it abruptly then it reflects this fact. How is it different from if you were talking directly with the remote peer and not via SSH tunneling - would you expect the socket to recover from a broken pipe as well ?

If on the other hand you mean that the SSH connection should be maintained even though the specific channel used for tunneling "breaks down", I believe you are right - however, I am not convinced this is what happens here. The way to diagnose this should be relatively simple:

* Establish a tunneled connection with some "application" you control (easy to write one that simply waits on a socket and echoes its input)
* Try to abort the connection from the application you control in various ways:
** Kill the process (but not the SSH server)
** Initiate a long data transfer and kill it in mid-transfer (similar to broken pipe)
* See what happens on the client side - can you still use the same *session* to re-establish the tunneling channel. If not, then indeed it feels like a bug. If it does happen, it would help to attach some information as to what calls are made inside SSSH client code that cause the session to be destroyed rather than just the channel

 I will look into it further (and so should you), but it will take some time....

> IOException (Broken pipe) on a socket local forwarding channel causes SSH client-server connection down
> -------------------------------------------------------------------------------------------------------
>
>                 Key: SSHD-795
>                 URL: https://issues.apache.org/jira/browse/SSHD-795
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.7.0
>            Reporter: Roberto Deandrea
>            Priority: Major
>
> Hi,
> I have a problem with local port forwarding mechanism implemented in Apache SSHD.
> In my company we successfully use Apache SSHD library for secure local socket forwarding protocols.
> When on a local port forwarding channel an IOException (Broken pipe) happen for some reason (network, etc...), the SSH client server is being disconnected abruptly.
> I'm not convinced this is the right behavior. I think it is not necessary to bring down SSH client server connection because this is not a protocol violation, but a socket problem related to forwarded remote server connection.
> Please, can you comment about this issue ?
> Follow an excerpt of the traces :
> {quote}
> 2018-01-23 10:30:10,017 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-2       ] [Nio2Session.handleWriteCycleFailure] handleWriteCycleFailure(Nio2Session[local=/192.168.180.70:38957, remote=/192.168.10.31:36228]) failed (IOException) to write 32768 bytes: Broken pipe
> 2018-01-23 10:30:10,017 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-3       ] [Window.waitForSpace] waitForSpace(Window[server/remote](TcpipServerChannel[id=662, recipient=11]-ServerSessionImpl[circessh@/192.168.190.2:14840])) available: 1146880
> 2018-01-23 10:30:10,017 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-2       ] [TcpipServerChannel.handleWriteDataFailure] handleWriteDataFailure(TcpipServerChannel[id=662, recipient=11]-ServerSessionImpl[circessh@/192.168.190.2:14840])[SSH_MSG_CHANNEL_DATA] failed (IOException) to write len=32768: Broken pipe
> 2018-01-23 10:30:10,018 WARN  [sshd-SshServer[1786f9d5]-nio2-thread-2       ] [AbstractSession.exceptionCaught] exceptionCaught(ServerSessionImpl[circessh@/192.168.190.2:14840])[state=Opened] IOException: Broken pipe
> 2018-01-23 10:30:10,018 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-3       ] [Window.waitAndConsume] waitAndConsume(Window[server/remote](TcpipServerChannel[id=662, recipient=11]-ServerSessionImpl[circessh@/192.168.190.2:14840])) - requested=32768, available=1146880
> 2018-01-23 10:30:10,018 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-2       ] [AbstractSession.exceptionCaught] exceptionCaught(ServerSessionImpl[circessh@/192.168.190.2:14840])[state=Opened] details
> java.io.IOException: Broken pipe
>         at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
>         at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
>         at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
>         at sun.nio.ch.IOUtil.write(IOUtil.java:65)
>         at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishWrite(UnixAsynchronousSocketChannelImpl.java:582)
>         at sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:195)
>         at sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
>         at sun.nio.ch.EPollPort$EventHandlerTask.run(EPollPort.java:293)
>         at java.lang.Thread.run(Thread.java:745)
> 2018-01-23 10:30:10,023 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-1       ] [Nio2Session.writePacket] writePacket(Nio2Session[local=/192.168.180.70:45470, remote=/192.168.10.31:22]) Writing 24780 bytes
> 2018-01-23 10:30:10,025 DEBUG [sshd-SshServer[1786f9d5]-nio2-thread-2       ] [SessionTimeoutListener.sessionException] sessionException(ServerSessionImpl[circessh@/192.168.190.2:14840]) IOException: Broken pipe
> {quote}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)