Multiple (multiplexed) simultaneous ssh connections - Cygwin bug?
Darren Tucker
dtucker at zip.com.au
Tue Sep 12 08:21:55 EST 2006
Goldburt, Dan wrote:
> Hi,
>
> Ok, so I'm thinking about taking Darren's suggestion:
>> It's not pretty but you could run multiple sshd's on several ports.
>
> But before I do, I was hoping to get some help in optimizing the fix.
>
> 1. What does the cygwin limitation bound my max sessions to?
> Is it:
> a) 30
>> You'll have the stdout and stderr descriptors in the
>> select's readset,
>> which for FD_SETSIZE=64 puts the limit at around 30
>> connections or so
>> (assuming you're not port forwarding or something too).
> b) 20
>> Thinking about it, that's wrong (I was thinking of poll).
>> Since select
>> uses bitmasks it doesn't matter how many are in each of
>> the readset and
>> writeset so the limit would be around 20 concurrent.
> or c) 10
>> I think I'm definitely overrunning the fd_set. Running the
>> test again with a just started sshd instance, I get the
>> error fcntl(31, F_GETFL, 0). So the limit seems to be 30
>> fds, or 10 connections (3 fd per connection).
I'm not sure, actually. You seem to be hitting some limit at 31
descriptors before the fd_set one, which should be at 64 (3 per session
= ~20 concurrent). What does "ulimit -n" report the descriptor limit
as, and do you have some local processes using some of them?
> 2. I need to make sure if I do still accidentally overrun the fd_set, I
> will not crash sshd. Right now it goes into an infinite loop spitting
> out "select: Bad file descriptor" and taking up 100% CPU. Surely this is
> a bug that needs to be patched?
Maybe, but it only occurs with modified code, right?
> 3. Any chance I can overcome the limitation from inside sshd? How do I
> implement the following:
>> To make this work, you would probably need to break the
>> select into FD_SETSIZE chunks somehow.
I was thinking of overloading select an associated macros in the compat
library but it's probably not trivial. Damien said that the fd_sets
were dynamically allocated but I'm not sure how that helps in the case
where there's more than FD_SETSIZE descriptors.
--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev at mindrot.org
http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
More information about the openssh-unix-dev
mailing list