[
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:36 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
h5.
{code:java}
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;
}{code}
h5.
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
h5. private SshClient getSSHClient()
h5. {
h5. SshClient client = SshClient.setUpDefaultClient();
h5. //handle "StrictHostKeyChecking=no" to skip host's public key checking for
h5. //example the host get imaged often, and OEDA does not access
h5. // .ssh/known_hosts
h5. client.setServerKeyVerifier(AcceptAllServerKeyVerifier.INSTANCE);
h5. client.setHostConfigEntryResolver(HostConfigEntryResolver.EMPTY);
h5. client.setKeyIdentityProvider(KeyIdentityProvider.EMPTY_KEYS_PROVIDER);
h5. CoreModuleProperties.HEARTBEAT_INTERVAL.set(client, HEARTBEAT);
h5. CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(client, HEARTBEATREPLYWAIT);
h5.
h5. //if no IDLE_TIMEOUT and READ_TIMEOUT, it can pass the unzip -l command
h5. //but give incomplete content of the zip file, but if enable TIMEOUT, get
stuck
h5. CoreModuleProperties.IDLE_TIMEOUT.set(client, IDLETIMEOUT);
h5.
CoreModuleProperties.NIO2_READ_TIMEOUT.set(client,IDLETIMEOUT.plusMinutes(10L));
h5. return client;
h5. }
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: [email protected]
For additional commands, e-mail: [email protected]