SSH: "The channel has been closed"

0 votes
asked Dec 12, 2011 by lackote (300 points)
edited Mar 12, 2012

I'm having problems executing commands with client.runcommand some commands works and some others fails (this particular command was grep), heres is the log:

2011-12-12 12:42:39.851 DEBUG Ssh(1) Info: Received 16384 bytes of data.
2011-12-12 12:42:39.851 DEBUG Ssh(1) Info: Received 16384 bytes of data.
2011-12-12 12:42:39.851 DEBUG Ssh(1) Info: Received 16384 bytes of data.
2011-12-12 12:42:39.867 DEBUG Ssh(1) Info: Received 16384 bytes of data.
2011-12-12 12:42:39.867 ERROR Ssh(1) SSH: Rebex.Net.SshException: The channel has been closed.
   at Rebex.Net.SshChannel.clmbOg(BBdsJfZ )
   at Rebex.Net.SshChannel.bOrbyiZ()
   at Rebex.Net.SshChannel.Receive(Byte[] buffer, Int32 offset, Int32 count)
commented Dec 13, 2011 by Lukas Pokorny (92,870 points)
edited Dec 13, 2011

A workaround for a similar problem has been added to the next release but not released yet. I will mail you a link to the current build of Rebex SSH Pack - please give it a try and let me know if the problem persists.

2 Answers

0 votes
answered Dec 14, 2011 by lackote (300 points)
edited Dec 16, 2011

Hi Lukas, I tried with the link you send me but unfortunately it doesn't work.. same error.. How can I know what is causing that error? I try the exact same "grep" command with 2 different files, one works well while the other shows that SshException

commented Dec 14, 2011 by Lukas Matyska (44,590 points)
edited Dec 14, 2011

Could you please create two communication logs in Verbose mode and send it to us at support@rebex.net. One for grep with a failure and second one for the grep without a failure. We can tell you more after analyzing the log files.

Please create the log as follows:

Ssh client = new Ssh();
client.Connect(...);
client.Login(...);

client.LogWriter = 
client.Session.LogWriter = 
    new Rebex.FileLogWriter("c:/temp/ssh.log", Rebex.LogLevel.Verbose);
client.RunCommand("your grep command");
commented Dec 16, 2011 by lackote (300 points)
edited Dec 16, 2011

Email sent, thank you Lukas.

commented Dec 16, 2011 by lackote (300 points)
edited Dec 16, 2011

Problem Solved with new version (4368) thank you!

0 votes
answered Dec 19, 2011 by Lukas Pokorny (92,870 points)
edited Mar 12, 2012

Thanks for letting us know about this issue! This was caused by a bug in SSH code and it will be fixed in the next release.

UPDATE

The fix is included in Release 2012 R1. SshChannel no longer attempts to adjust window size after the channel has been closed.

...