PowerShell / PowerShell/Win32-OpenSSH
SSH session does not correctly release file handles after closing
@vthiebaut10 is already working on this.
Since Oct 2, 2023.
- Dominant language
- No language data
- Stars
- 8.3k
- Forks
- 819
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
After establishing a connection, my SSH client reuses this connection and creates a session every second over this connection, sending an exec command on ssh channel to execute some simple script commands, and then closes this session. After my client program ran continuously for about 20 days, my Windows machine hung due to exhausted memory. Analysis revealed that the sshd process had a large number of handles that were not correctly released, as well as a significant number of residual cmd.exe processes.
I tried upgrading to version v9.2.2.0p1-Beta, but the issue still persists. However, after switching to the Bitvise SSH Server software, this problem no longer occurred. As a comparison, the same logic works as expected when running on Linux and macOS servers. I believe this should be a relatively easy case to reproduce, so I won't go into further details.
Expected behavior
no leaks
Actual behavior
file handlers leak
Error details
No response
Environment data
Name Value
---- -----
PSVersion 5.1.22621.1778
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.1778
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Version
8.6p1
Visuals
too many file handlers hold by sshd.exe
about 2000000 cmd.exe processes, all 32K page table used
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.