- Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Steps to reproduce
Setup powershell ssh on linux system using the following guide: https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core?view=powershell-7
On the host machine (debian 10) execute the following command.
Invoke-Command -ScriptBlock{return "kaas"} -SSHTransport -HostName ps@localhost -KeyFilePath /home/ps/.ssh/id_rsa Expected behavior
No defunct processes from SSH on the machine executing PowerShell.
Actual behavior
Each execution of the PowerShell script leaves a defunct ssh process. See example of 'ps aux' below.
On the parent process there remains a CPU load which is unexpected for a server application. This becomes a major issue with a large amount defunct processes which seems to stack the CPU load on the parent process.
root@<machine>:/app# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 3880 1504 ? Ss 09:34 0:00 /bin/bash /entrypoint.sh root 21 0.1 1.1 3794740 70496 ? Sl 09:34 0:02 dotnet <dll> root 81 0.0 0.0 4012 3116 pts/0 Ss 09:35 0:00 bash root 338 0.0 0.0 4012 3196 pts/1 Ss 09:39 0:00 bash root 1201 0.0 0.4 2968504 27624 pts/0 Sl+ 09:53 0:00 pwsh root 1209 1.9 2.0 4157756 125756 pts/0 Sl+ 09:53 0:04 dotnet /root/.dotnet/tools/.store/powershell/7.0.3/powershe root 1240 0.0 0.0 0 0 pts/0 Z+ 09:53 0:00 [ssh] <defunct> root 1247 0.0 0.0 0 0 pts/0 Z+ 09:53 0:00 [ssh] <defunct> root 1253 0.0 0.0 0 0 pts/0 Z+ 09:53 0:00 [ssh] <defunct> root 1267 0.0 0.0 0 0 pts/0 Z+ 09:53 0:00 [ssh] <defunct> root 1274 0.0 0.0 0 0 pts/0 Z+ 09:53 0:00 [ssh] <defunct> root 1373 0.3 0.0 0 0 pts/0 Z+ 09:57 0:00 [ssh] <defunct> root 1377 0.0 0.0 7652 2684 pts/1 R+ 09:57 0:00 ps aux Environment data
Host machine:
Name Value ---- ----- PSVersion 7.0.3 PSEdition Core GitCommitId 7.0.3 OS Linux 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 Platform Unix PSCompatibleVersions{1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 Target machine:
Name Value ---- ----- PSVersion 7.0.3 PSEdition Core GitCommitId 7.0.3 OS Linux 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 Platform Unix PSCompatibleVersions{1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 The configuration is that this is a Docker container (host) running a sidecar container (target).
The used image for the host is: 'mcr.microsoft.com/dotnet/core/aspnet:3.1'
The used image for the target is 'mcr.microsoft.com/powershell'