sshnet / sshnet/SSH.NET

Shellstream is disposed when receiving huge response

Open
#1,762 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

Hi Guys,

Need your help to resolve my issue.
I send a ssh command to my router "show bgp nei xxx advertised-route", the response is huge and need more than 15 minutes to complete.
If I save the response, the size is 600Mb.

The problem occur when I send the second command, it was said that the shellstream is disposed while my ssh connection is still open.

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Renci.SshNet.ShellStream'.
at Renci.SshNet.ShellStream.Write(String text)
at esihaur.SSH.SSHJob.WriteToStream(String command)

void WriteToStream(string command) { if (isConnected) { ca_Shell.Write(command); ca_Shell.Flush(); } }

public bool isConnected { get { return (ca_client != null && ca_client.IsConnected); } }

Please share guys if any solution

Thank You

Regards,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ShellStream.Write and the reported SSHJob.WriteToStream call, then trace how a long response and the subsequent command affect stream disposal. Reproduce the 600 MB, 15-minute response scenario if possible and inspect the two-command sequence. Done means identifying whether SSH.NET or the caller disposes the stream and adding a regression test or a clearly documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.