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

Goldstein Lyor commented on SSHD-580:
-------------------------------------

I have tried the patch, and while it seems harmless it causes some problems -  
_ClientTest#testClientStillActiveIfListenerExceptions_ fails 99.999% of the 
time, although this seems to be a *timing* issue. In order to re-produce it 
with very high probability you should simply run _mvn -Dtest=ClientTest clean 
test_.

I am attaching a few modifications I already did to the original patch - you 
are welcome to apply them (or not) and figure out why the test fails.

> getInvertedIn.close() does not close stdin of remote program
> ------------------------------------------------------------
>
>                 Key: SSHD-580
>                 URL: https://issues.apache.org/jira/browse/SSHD-580
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Volth
>            Priority: Minor
>         Attachments: AbstractClientChannel.diff, ChannelOutputStream.diff
>
>
> {code:java}
> val channel = session.createExecChannel("cat /dev/stdin")
> channel.setOut(new sshd.common.util.io.NoCloseOutputStream(System.out))
> channel.setErr(new sshd.common.util.io.NoCloseOutputStream(System.err))
> channel.open().verify()
> val out = channel.getInvertedIn
> out.write("lala\nla".getBytes)
> out.close()
> channel.waitFor(sshd.client.channel.ClientChannel.ClientChannelEvent.CLOSED 
> :: Nil, 0)
> {code}
> I expect that out.close() would close stdin of remote program and such 
> process as "cat /dev/stdin" would terminate after reading stdin to the end.
> It works well when the pumping thread is in action:
> {code:java}
> val channel = session.createExecChannel("cat /dev/stdin")
> channel.setOut(new sshd.common.util.io.NoCloseOutputStream(System.out))
> channel.setErr(new sshd.common.util.io.NoCloseOutputStream(System.err))
> channel.setIn(new ByteArrayInputStream("lala\nla".getBytes))
> channel.open().verify()
> channel.waitFor(sshd.client.channel.ClientChannel.ClientChannelEvent.CLOSED 
> :: Nil, 0)
> {code}
> The pumping thread sends SSH_MSG_CHANNEL_EOF message at the end of the data.
> invertedIn.close() does not.
> Tested agains git "master" and wide range of remote ssh-servers



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to