PowerShell / PowerShell/Win32-OpenSSH

Windows Open SSH Server cannot support more than 512 concurrent ssh sessions (posix_spawn failing)

Open
#2,045 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-sshd Issue-Enhancement
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

Hi to all,
I'm developing an application that needs to create a huge number of cuncurrent ssh sessions.

Server Operating System
Windows 11 and Windows server 2016 (I have the same issue on both systems)

Client Operating System
Windows 10 pro

Everything works well when I open 512 concurrent ssh sessions, but when I open the 513th concurrent session or more I receive on client side: connection reset

I see, if can help, that there is an old similar closed bug that had the same problem but with a smaller number of connections (50)

https://github.com/PowerShell/Win32-OpenSSH/issues/1096

Expected behavior
Support > 512 connections
Actual behavior
Stops every time at 512 exactly
Error details
Log on server side:

1452 2023-03-24 10:46:47.906 debug3: fd 6 is not O_NONBLOCK
1452 2023-03-24 10:46:47.906 debug3: spawning "C:\\Program Files\\OpenSSH\\sshd.exe" -R as subprocess
1452 2023-03-24 10:46:47.906 error: server_accept_loop, posix_spawn failed
1452 2023-03-24 10:46:47.906 debug3: send_rexec_state: entering fd = 10 config len 2205
1452 2023-03-24 10:46:47.906 debug3: ssh_msg_send: type 0
1452 2023-03-24 10:46:47.906 debug3: write ERROR from cb(2):232, io:0000014EA341F1D0
1452 2023-03-24 10:46:47.906 error: ssh_msg_send: write: Unknown error
1452 2023-03-24 10:46:47.906 error: send_rexec_state: ssh_msg_send failed
1452 2023-03-24 10:46:47.906 debug3: send_rexec_state: done
1452 2023-03-24 10:46:47.906 debug3: ReadFileEx() ERROR:109, io:0000014EA341F100
Environment data
Name                           Value
----                           -----
PSVersion                      5.1.14393.5582
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.5582
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Version

OpenSSH_for_Windows_9.2p1, LibreSSL 3.6.1

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating the server_accept_loop and the posix_spawn failure shown in the server log, then reproduce the behavior at 512 and 513 concurrent sessions on the stated Windows environments. Done means the server accepts more than 512 concurrent SSH sessions without connection resets or spawn failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking, operating-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.