Quantcast
Channel: SSH.NET Library
Viewing all 2955 articles
Browse latest View live

Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: avidyarthi **

Nobody else having this issue?


Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: drieseng **

Please try posting the smallest possible - but still complete - code that allows you to reproduce this issue.

Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: avidyarthi **

public void SendFiles()
{

string path = @"C:\Projects\abc.csv";

SSHNet.PasswordConnectionInfo connInfo = new SSHNet.PasswordConnectionInfo(SFTPRequest.SFTP_Host,
SFTPRequest.SFTP_Port, SFTPRequest.SFTP_UserName, SFTPRequest.SFTP_Password);

using (var client = new SSHNet.SftpClient(connInfo))
{
foreach (var d in connInfo.Encryptions.Where(p => p.Key != "aes128-cbc").ToList()) { connInfo.Encryptions.Remove(d.Key); }
client.Connect();

if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, "abc.csv"), false, null);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}
}

Commented Unassigned: An operation was attempted on something that is not a socket. [1940]

$
0
0
I keep getting this error when connecting and uploading a file. There are no errors in Event Log or otherwise.

Here's my code:

SSHNet.PasswordConnectionInfo connInfo = new SHNet.PasswordConnectionInfo(xxxxxxxxxxx);

using (var client = new SSHNet.SftpClient(connInfo))
{
client.Connect();
if (client.IsConnected)
{
using (Stream fileStream = EncryptionUtilities.DecryptFile(path))
{
client.UploadFile(fileStream, path);
fileStream.Flush();
fileStream.Close();
fileStream.Dispose();
}
}

client.Disconnect();
}

Any suggestions highly appreciated.
Comments: ** Comment from web user: avidyarthi **

Above is the function I call to upload a file. As you can see from the trace, it looks like the exception occurs when disconnecting from the client.

New Post: on cisco router no response after send Enable

$
0
0
Paul,

I'm too lazy to debug your code, as you are taking a different approach to communication than I did/do. I try to modularize it a bit so I don't get lost! :) I imagine you are at the 'just make it work and I'll make it pretty later' stage... So to help get you out of a rut, this is a copy of an earlier post to someone doing the same things as you. My example is also in VB.NET:
In working with Cisco equipment, for example, I found that you had to be careful about when to issue CR, LF, CRLF, or even nothing! To help others extend renci, I wrote a short blog article on how to wrap commands/messages sent.

At first I added the necessary variations to the source (didn't I post that a while ago as a suggestion?), but when new source was coming out without the subtle inclusions, I had to wrap it to do the same thing.

Maybe it will help you...?

All around, best ssh app/library out there, IMHO... :)
Let me know if this gets you out of your rut & moving again!

pat
:)

Reviewed: 2013.4.7 (Apr 09, 2014)

$
0
0
Rated 5 Stars (out of 5) - Great library. Used in high performance production system with almost no problems

Commented Issue: Unhandled exception during SftpClient Dispose [1581]

$
0
0
We are facing an unhandled exception during Dispose of the SftpClient.

2013-05-13 12:54:22,711 [2] FATAL - AppDomain.UnhandledException
Renci.SshNet.Common.SshConnectionException: Client not connected.
at Renci.SshNet.Session.SendMessage(Message message)
at Renci.SshNet.Channels.Channel.Close(Boolean wait)
at Renci.SshNet.Channels.ChannelSession.Close(Boolean wait)
at Renci.SshNet.Channels.Channel.Dispose(Boolean disposing)
at Renci.SshNet.Sftp.SubsystemSession.Dispose(Boolean disposing)
at Renci.SshNet.Sftp.SftpSession.Dispose(Boolean disposing)
at Renci.SshNet.SftpClient.Dispose(Boolean disposing)
at Renci.SshNet.BaseClient.Finalize()

This happens when the connection to the Ssh server is lost and affects our ability to gracefully handle situations when servers/connectivity goes down. O

The solution I suggest to swallow any exceptions coming from SftpClient.Dispose() as follows. Not pretty but as a general rule, Dispose shouldnt be throwing exceptions, unless such exceptions are symtomatic of a more serious problem.

Cheers

protected override void Dispose(bool disposing)
{
try
{
if (this._sftpSession != null)
{
this._sftpSession.Dispose();
this._sftpSession = null;
}

if (this._disposeConnectionInfo)
((IDisposable)this.ConnectionInfo).Dispose();

base.Dispose(disposing);
}
catch
{
// swallow it
}
}
Comments: ** Comment from web user: winkledumpling **

Fixed, thanks greatly. Ill wait for the formal release before upgrading

New Post: on cisco router no response after send Enable

$
0
0
Hi Pat,

Thanks for your reply.

I've read your article before and it sure helped.
But, I'm equally sure it's not a 'when to send a CR, LF, CRLF character' problem.

After sending enable (sshStream.Write("enable" & vbCr)), this is what I've read from the stream:
c3745>
terminal length 0
c3745>
enable
Password: 
I then write the password:
sshStream.Write(ClientEnablepassword & vbCr)
and in the stream only an empty line is added
c3745>
terminal length 0
c3745>
enable
Password: 

It looks like I should write and read from an other stream after sending the enable password??

Paul

Commented Unassigned: DownloadFile/UploadFile fails if path starts with '~' [1947]

$
0
0
Seems there are quite a few places where SSH.Net does not handle paths that start with "~" properly. This particular case is a regression in the latest beta since this used to work now no longer does.

To reproduce, simply try to download or upload a file whose path starts with "~".
Comments: ** Comment from web user: BitFlipper **

That is true, however there are places where SSH.Net appends the WorkingDirectory to any path that doesn't start with '/'. At a minimum it should consider a path starting with '~' as an absolute path and not a relative path.

Take a look at SftpSession.GetFullRemotePath to see how it will convert "~/somedir" to "/workingdir/~/somedir".

Commented Unassigned: DownloadFile/UploadFile fails if path starts with '~' [1947]

$
0
0
Seems there are quite a few places where SSH.Net does not handle paths that start with "~" properly. This particular case is a regression in the latest beta since this used to work now no longer does.

To reproduce, simply try to download or upload a file whose path starts with "~".
Comments: ** Comment from web user: BitFlipper **

To clarify why I'm saying this is a regression...

In the previous beta I added the following into SftpSession.GetFullRemotePath to fix the issue:

```
if (string.IsNullOrEmpty(path) || path[0] == '~')
{
return path;
}
```

I did the same with the latest beta code but this time my fix did not resolve the issue. So the latest beta must have some new path manipulation code somewhere else that also doesn't handle '~' properly.

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: drieseng **

I still haven't been able to reproduce the ObjectDisposedException. Not even after more than 4000 runs.

New Post: on cisco router no response after send Enable

$
0
0
Please try the current beta version. There are changes at WriteLine() (and Write()?)

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: da_rinkes **

I removed the:

Console.WriteLine("Line: " + shell.ReadLine());

and set the Timer-Interval to:

_timer = new Timer(500);

now it happens very earlier. 10 times around Run 200.

Looks like a race condition to me.

New Post: on cisco router no response after send Enable

$
0
0
Thanks for your response da_rinkes.

Unfortunately I have the same result: after sending enable only newlines can be found in the shellstream, one for each subsequent command sent.

Commands are being received on the Cisco router. I've send a reload command (an enabled mode command) and the router restarted.

So: I can confirm that all commands are being sent, and that I do not see the router's responses, once the enable command has been sent.


Paul

New Post: enable pty allocation

$
0
0
Hello all,

it's me again :-)
On a typicall Linux Client I can use the -t option for connection without tty or pty allocation or to use pseudo allocation.
I found some Links, where the Situation is explained, but unfortunatelly no information inside the Dokumentation how to fix this with ssh.net (renci.ssh).
Has someone a hint to show me right direction?

To explain the Situation a little bit more:
The connection to the Server is working.
I run these commands:
$ErrorActionPreference = 'SilentlyContinue'
$SshClient.Disconnect()
$SshClient.Dispose()
sleep -Seconds 2
$SshClient = New-Object Renci.SshNet.SshClient($ret[11], 22,$ret[8],$ret[9])
$SshClient.Connect()
#So far so good!!!!
$nicinfo = $SshClient.RunCommand("ifconfig eth0")
$output = $nicinfo.CommandText
$output | Out-File $logfile -Append
$output = $nicinfo.Result
$output | Out-File $logfile -Append
# ERROR in Logfile
The Links:
http://stackoverflow.com/questions/10330678/gitolite-pty-allocation-request-failed-on-channel-0/10346575#10346575
http://lugatgt.org/2009/10/28/ssh-tips-and-tricks-2/
http://stackoverflow.com/questions/17900760/what-is-pseudo-tty-allocation-ssh-and-github

Regards,
Stefan

New Post: on cisco router no response after send Enable

$
0
0
Update:
I've tried my test program on another Cisco router (2621) and there it's all working perfectly!

The problem seems to be related to specific router(s), such as my test-router: 3745

Paul

New Post: Small File Upload Problem

$
0
0

Hello,

First of all, I want to say I really appreciate the work you do and what you are doing with this project.

I updated to the 2014.4.6-beta1 release and the problem is fixed.

However, I have noticed that the time to connect to some servers is now taking longer.

My process connects to various servers every 2 minutes.

With the previous version 2013.1.27 with my own fix (change buffer size to 8K) the time it takes to connect to our MoveIt server is typically from 3-7 seconds.

But with the beta version I am now seeing fluctuating times e.g. 80,3,51,3,3,36,2,75,2,73,8,3,6,74,3,75,2

I also see the same behaviour with some Linux servers.

But not all servers. We have another MoveIt server and also some Linux servers which are connecting quickly, just as they did before.

So I don’t think it’s related to the type of server, it must be related to settings on the servers.

I appreciate there is now some additional logic in the beta version which negotiates tcp window size, do you have an explanation why the time to connect is longer than before, but it seems to fluctuate between each connection attempt, and also is OK on some servers but not on others ?

Thank You

Phillip Strong

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: da_rinkes **

Here Output with Debug Infos of SSH.NET:

Opened Shell is right after "using (var shell = _client.CreateShellStream("xterm", 80, 80, 640, 480, 0))"

```
Opened Shell
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #340'.
SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #3'.
SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #340'.
A first chance exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\ShellStream.cs:Zeile 735.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Channels\Channel.cs:Zeile 285.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Channels\Channel.cs:Zeile 566.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Session.cs:Zeile 1455.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Session.cs:Zeile 1109.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Session.NET40.cs:Zeile 16.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Downloads\sshnet-35235\Renci.SshClient\Renci.SshNet\Session.cs:Zeile 1662.
```

Commented Unassigned: various System.ObjectDisposedException [1944]

$
0
0
during a long connection I get following exceptions:

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei Renci.SshNet.Session.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 642.
bei Renci.SshNet.Channels.Channel.WaitHandle(WaitHandle waitHandle) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 496.
bei Renci.SshNet.Channels.ChannelSession.Open() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\ChannelSession.cs:Zeile 52.
bei Renci.SshNet.ShellStream..ctor(Session session, String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 maxLines, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 73.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize, IDictionary`2 terminalModeValues) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 384.
bei Renci.SshNet.SshClient.CreateShellStream(String terminalName, UInt32 columns, UInt32 rows, UInt32 width, UInt32 height, Int32 bufferSize) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\SshClient.cs:Zeile 366.
```

and

```
System.ObjectDisposedException: Das SafeHandle wurde geschlossen.
bei System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success)
bei Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
bei System.Threading.EventWaitHandle.Set()
bei Renci.SshNet.ShellStream.Channel_DataReceived(Object sender, ChannelDataEventArgs e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\ShellStream.cs:Zeile 739.
bei Renci.SshNet.Channels.Channel.OnData(Byte[] data) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 289.
bei Renci.SshNet.Channels.Channel.OnChannelData(Object sender, MessageEventArgs`1 e) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Channels\Channel.cs:Zeile 590.
bei System.EventHandler`1.Invoke(Object sender, TEventArgs e)
bei Renci.SshNet.Session.OnChannelDataReceived(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1392.
bei Renci.SshNet.Session.HandleMessage(ChannelDataMessage message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1034.
bei CallSite.Target(Closure , CallSite , Session , Object )
bei Renci.SshNet.Session.HandleMessageCore(Message message) in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.NET40.cs:Zeile 20.
bei Renci.SshNet.Session.MessageListener() in c:\Users\srinkes\Desktop\Projects\XXX\Renci.SshNet\Session.cs:Zeile 1589.
```

The application opens a ssh connection and opens/parses a ShellStream every 10 seconds.
IsConnected stays true.

I currently can't test the current beta since it has issues with closing the channel after
disposing the ShellStream.

No errors or unusual log entries on the server side.
Comments: ** Comment from web user: da_rinkes **

Pimped Tool for the Bug:
https://gist.github.com/darinkes/10380451

Example Output after pressing enter after the tool runs for a while:

```
Run-Time: 00:06:56.3235051
Exceptions: 12
Runs: Das SafeHandle wurde geschlossen. (288)
Runs: Das SafeHandle wurde geschlossen. (61)
Runs: Das SafeHandle wurde geschlossen. (642)
Runs: Das SafeHandle wurde geschlossen. (642)
Runs: Das SafeHandle wurde geschlossen. (311)
Runs: Das SafeHandle wurde geschlossen. (82)
Runs: Das SafeHandle wurde geschlossen. (371)
Runs: Das SafeHandle wurde geschlossen. (16)
Runs: Das SafeHandle wurde geschlossen. (1611)
Runs: Das SafeHandle wurde geschlossen. (6)
Runs: Das SafeHandle wurde geschlossen. (2)
Runs: Das SafeHandle wurde geschlossen. (166)
```

Output shows you the Exception-Message (german in my case, sry for that ;)) and the time of runs till the
exception occured.
As you can see there is no clear pattern :/

New Post: Get the string result from Execute() during the execution

Viewing all 2955 articles
Browse latest View live


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