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/15 22:30:00 UTC
[jira] [Comment Edited] (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:comment-tabpanel&focusedCommentId=17249987#comment-17249987 ]
min yun law edited comment on SSHD-1112 at 12/15/20, 10:29 PM:
---------------------------------------------------------------
please try download the big zip file from [https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#19c], and the command to run in remote node as:
/usr/bin/unzip -l /u01/LINUX.X64_193000_db_home.zip
Actually above code get stuck in channel.waitFor() with 0L wait time.
also here is method to get SshClient that cause the issue in above code
private SshClient getSSHClient()
{ SshClient client = SshClient.setUpDefaultClient();
//handle "StrictHostKeyChecking=no" to skip host's public key checking for
//example the host get imaged often, and OEDA does not access
// .ssh/known_hosts
client.setServerKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE); client.setHostConfigEntryResolver(HostConfigEntryResolver.EMPTY); client.setKeyIdentityProvider(KeyIdentityProvider.EMPTY_KEYS_PROVIDER);
CoreModuleProperties.HEARTBEAT_INTERVAL.set(client, HEARTBEAT); CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(client, HEARTBEATREPLYWAIT);
//if no IDLE_TIMEOUT and READ_TIMEOUT, it can pass the unzip -l command
//but give incomplete content of the zip file, but if enable TIMEOUT, get stuck CoreModuleProperties.IDLE_TIMEOUT.set(client, IDLETIMEOUT);
CoreModuleProperties.NIO2_READ_TIMEOUT.set(client,IDLETIMEOUT.plusMinutes(10L));
return client;
}
Check the comment for the TIMEOUT code, which if disable this two lines, it pass the channel.waitFor(), but the return result of unzip -l is not complete, and no return code, and Collection<ClientChannelEvent> waitMask has only two status [CLOSED, OPENED]
was (Author: minlaw):
please try download the big zip file from [https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#19c], and the command to run in remote node as:
/usr/bin/unzip -l /u01/LINUX.X64_193000_db_home.zip
Actually above code get stuck in channel.waitFor() with 0L wait time.
also here is method to get SshClient that cause the issue in above code
private SshClient getSSHClient()
{
SshClient client = SshClient.setUpDefaultClient();
//handle "StrictHostKeyChecking=no" to skip host's public key checking for
//example the host get imaged often, and OEDA does not access
// .ssh/known_hosts
client.setServerKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE);
client.setHostConfigEntryResolver(HostConfigEntryResolver.EMPTY);
client.setKeyIdentityProvider(KeyIdentityProvider.EMPTY_KEYS_PROVIDER);
CoreModuleProperties.HEARTBEAT_INTERVAL.set(client, HEARTBEAT);
CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(client, HEARTBEATREPLYWAIT);
//if no IDLE_TIMEOUT and READ_TIMEOUT, it can pass the unzip -l command
//but give incomplete content of the zip file, but if enable TIMEOUT, get stuck
CoreModuleProperties.IDLE_TIMEOUT.set(client, IDLETIMEOUT);
CoreModuleProperties.NIO2_READ_TIMEOUT.set(client,
IDLETIMEOUT.plusMinutes(10L));
return client;
}
Check the comment for the TIMEOUT code, which if disable this two lines, it pass the channel.waitFor(), but the return result of unzip -l is not complete, and no return code, and Collection<ClientChannelEvent> waitMask has only two status [CLOSED, OPENED]
> 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
>
> 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