min yun law created SSHD-1112:
---------------------------------
Summary: 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
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: [email protected]
For additional commands, e-mail: [email protected]