-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix for SSH remoting when SSH client abruptly terminates #4123
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
Conversation
@@ -1636,4 +1636,7 @@ All WinRM sessions connected to Windows PowerShell session configurations, such | |||
<data name="InvalidRoleCapabilityFileExtension" xml:space="preserve"> | |||
<value>The provided role capability file {0} does not have the required .psrc extension.</value> | |||
</data> | |||
<data name="SSHTerminated" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe SSHAbruptlyTerminated ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will change.
if (string.IsNullOrEmpty(error) || | ||
if (error == null) | ||
{ | ||
return error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you decide to return null here and throw in the calling function? Why not just throw here and make the ReadError() function always return non-null strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No special reason except that I think of ReadError() helper method as a wrapper to StreamReader. But I agree that it would be cleaner to just throw in ReadError()
@iSazonov Do you have any additional comments or concerns? |
LGTM. |
This PR is for Issue #4122
If the SSH client process that PowerShell is using for the SSH transport terminates abruptly the StreamReader will return null instead of closing the pipe for a normal process exit.
The current error stream reading code ignores null StreamReader values resulting in a hang where the remote session never ends.
Fix is to throw an error when this occurs.