-
-
Notifications
You must be signed in to change notification settings - Fork 942
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
ArgumentNullException after upgrading from 2024.0.0 to 2024.0.1 #1557
Comments
Hi, are you able to reproduce the problem? I am guessing it is coming from here: SSH.NET/src/Renci.SshNet/SshCommand.cs Line 308 in a553152
and somehow _channel is already disposed (or disposing) at this point. But nothing stands out as an obvious problem |
Hey there, I am also having this problem although only when running on my Linux machine, not on my Windows machine which is odd - even though both are connecting to the same machine. I referenced a local clone of this repo and added some extra logs to help track it down. Here's what it looks like when it's working
And here's what it looks like when it fails
The important bit seems to be that it is responding to a channel close message before the ref: public bool SendExecRequest(string command)
{
_ = _channelRequestResponse.Reset();
Console.WriteLine("ChannelSession.SendExecRequest: Sending command: {0}", command);
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new ExecRequestInfo(command, ConnectionInfo.Encoding)));
Console.WriteLine("ChannelSession.SendExecRequest: Waiting for response");
WaitOnHandle(_channelRequestResponse);
Console.WriteLine("ChannelSession.SendExecRequest: Response received");
return _channelRequestSucces;
} Without the logs the error happens probably one in every 30 requests, but every log I add to SSH.NET makes it less likely to happen, which means it's some kind of timing issue that the slight pause from writing the logs is somewhat alleviating. In case it's helpful, I've pushed a commit with the added logs so you can see exactly where they are coming from 1c66a22. |
Thanks @James-LG for the excellent details. I understand the problem, just not decided how best to fix it. Good fun with wait handles... |
After upgrading from version 2024.0.0 to 2024.0.1, I encountered an
ArgumentNullException
in theWaitOnHandle
method. This issue occurs when executing an SSH command asynchronously.background service encountered an unhandled exception
System.ArgumentNullException: Value cannot be null. (Parameter 'waitHandle')
at System.ArgumentNullException.Throw(String paramName)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.SshCommand.ExecuteAsync(CancellationToken cancellationToken)
The text was updated successfully, but these errors were encountered: