Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Edited Issue: SshCommand doesn't cleanup subscribed events [2295]

$
0
0
The SshCommand class leaves the unerlying channel subscribed to the session events after running a command.

Repro is:
```
using (var client = new SshClient(connectionInfo))
{
client.Connect();

for (var i = 0; i < 100; ++i)
{
// Inspect client.Session.ErrorOccured.GetInvocationList()
using (var cmd = client.CreateCommand("echo hi"))
{
cmd.Execute();
}
// Inspect client.Session.ErrorOccured.GetInvocationList()
// Invocation list is one greater than before.
}
var after = GetEventCount(client);
Assert.AreEqual(before, after);
}
```

It looks like the bug is in SshCommand.EndExecute where this._channel is set to null without being disposed. A proposed fix is attached.
Comments: ** Comment from web user: drieseng **

Thanks for the report, and the patch!
Fix is committed in changeset 40527.
I also did some refactoring in previous changesets to allow us to unit test the fix for this issue.


Viewing all articles
Browse latest Browse all 1026

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>