Skip to content

Expect doesn't wake up after disconnect #670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sterlind opened this issue Apr 30, 2020 · 2 comments
Closed

Expect doesn't wake up after disconnect #670

sterlind opened this issue Apr 30, 2020 · 2 comments
Milestone

Comments

@sterlind
Copy link

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.

@WojciechNagorski
Copy link
Collaborator

It's done in #1274

@WojciechNagorski WojciechNagorski added this to the 2023.0.1 milestone Dec 21, 2023
@WojciechNagorski
Copy link
Collaborator

The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants