Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Expect doesn't wake up after disconnect #670

Copy link
Copy link
@sterlind

Description

@sterlind
Issue body actions

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.