-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
This is trivially easy to reproduce by just trying to connect to a system that does not exist (e.g. test@test). However, it can also randomly happen when trying to connect to system that is rebooting, which is how I discovered it.
To prove that it's ssh process termination that triggers this bug, try running Invoke-Command -HostName ... with this running in the background:
while ($true) {
Start-Sleep -Milliseconds 500
Stop-Process -Name "ssh" -ErrorAction SilentlyContinue -PassThru
}The only workaround seems to be to use the -ConnectingTimeout parameter, but it just forces pwsh to wait the entire timeout duration, even though ssh.exe isn't even running.
Expected behavior
# It should behave exactly like ssh.exe:
PS C:\> ssh.exe test@test "echo 1"
ssh: Could not resolve hostname test: No such host is known.
PS C:\>Actual behavior
PS C:\> Invoke-Command -HostName "test" -UserName "test" -ScriptBlock { echo 1 }
ssh: Could not resolve hostname test: No such host is known.
<Indefinite hang, need to press Ctrl+C to regain prompt, breaking non-interactive sessions>
# New-PSSession is also impacted:
PS C:\> New-PSSession -HostName "test" -UserName "test"
ssh: Could not resolve hostname test: No such host is known.
<hang>
# Also, -ErrorAction doesn't help:
PS C:\> Invoke-Command -HostName "test" -UserName "test" -ScriptBlock { echo 1 } -ErrorAction Stop
ssh: Could not resolve hostname test: No such host is known.
<hang>Error details
Environment data
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
No response
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.WG-RemotingPSRP issues with any transport layerPSRP issues with any transport layer