You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "min yun law (Jira)" <ji...@apache.org> on 2020/12/16 18:47:00 UTC

[jira] [Resolved] (SSHD-1112) Cannot return large output from channel.getInvertedOut() in version 2.6.0

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

min yun law resolved SSHD-1112.
-------------------------------
    Fix Version/s: 2.6.0
       Resolution: Workaround

when use different thread for waitFor() and inputstream, it work.

also it must call above two actions.

> Cannot return large output from channel.getInvertedOut() in version 2.6.0
> -------------------------------------------------------------------------
>
>                 Key: SSHD-1112
>                 URL: https://issues.apache.org/jira/browse/SSHD-1112
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.6.0
>            Reporter: min yun law
>            Priority: Major
>             Fix For: 2.6.0
>
>
> The mina sshd version is 2.6.0 from github
> try to run the linux command "unzip -l bigzipfile.zip" in remote node, where the bigzipfile.zip had lots of files and folders which packed as one big zip file. the channel get stuck for a while and return exception : Pipe closed after 0 cycles
>  
> Here is sample code:
> String getExecCommandResult(ClientChannel channel)
> {
>         channel.open().await();
>         Collection<ClientChannelEvent> waitMask = channel.waitFor(
>  EnumSet.of(ClientChannelEvent.CLOSED, ClientChannelEvent.EXIT_STATUS,
>  ClientChannelEvent.EXIT_SIGNAL, ClientChannelEvent.EOF),
>  0L //no TIMEOUT status returned if 0L
>  );
>      
> InputStream in = channel.getInvertedOut();
>  String outputStr = "";
>  if(in != null)
> {
> outputStr = readStream(in);  //this is place that get stuck and exception is thrown
>  }
> return outputStr;
> }
>  
> String readStream(InputStream inputStream)
>  {
>  String line = null;
>  String m_cmdOutput = "";
> try (BufferedReader bufReader = new BufferedReader(
>  new InputStreamReader(inputStream)))
>  {
>  while ((line = bufReader.readLine()) != null)
>  {
>  m_cmdOutput += line + Constants.getDelimiter();
>  }
>  }
>  catch (Exception ex)
>  {
>  //output the exception
>  }
> return m_cmdOutput;
> }
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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