Closed
Description
If the connection is lost while we're waiting in ShellStream.Expect()
, Expect() doesn't wake up, either hanging forever or until the timeout elapses.
Here's a simple repro. I configured the target server (a Cisco NCS-5K) to end sessions that have been idle for 30 seconds, and then I set an expect that never matches. The connection dies 30 seconds in, but the Supercalifragilisticexpialidocious Expect waits 5 excruciating minutes to return:
var ssh = new SshClient(info);
ssh.Connect();
using (var shell = ssh.CreateShellStream("xterm", 80, 80, 80, 80, 1024))
{
shell.Expect("#", TimeSpan.FromSeconds(30));
Trace.TraceInformation("Shell has started!");
var time = Stopwatch.StartNew();
var result = shell.Expect("Supercalifragilisticexpialidocious!", TimeSpan.FromMinutes(5));
Trace.TraceInformation($"Shell took {time.Elapsed} to time out..");
}
Expect() should return immediately upon disconnect.
Metadata
Metadata
Assignees
Labels
No labels