git : The remote end hung up unexpectedly - too many simultaneous users?
We have a self hosted git server (Gitolite) on a VPS account (CPU:2.68GHz RAM:1824MB). This same VPS is also used to publish our underdevelopment web apps for client demos. (Very little traffic). so the main use of the server is as a Git Server Only.
This git server is accessed by a team of 30-40 people for various projects. Our problem is that during the day when 6-7 people are trying to access the server (sometimes same repo) we get frequent error message:
ssh: connect to host xxx.xxx.xx.xx port 22: Bad file number fatal: The remote end hung up unexpectedly
After trying for 10-15 minutes it generally succeeds.
During early mornings and late nights when there are only 1-2 people, git commands work with 100% success rate. Also I would like to note that if I access the other file hosted on the server through HTTP it works fine.
I found a couple of questions on StackOverflow and on other sites regarding this. But most of the people see to point towards SSH key set up or conflicts between Msysgit and Cygns SSH.
However I don't think this is the problem in our case as we get this behavior on Win开发者_JAVA百科dows (using msysgit only) as well as Mac Machines. Also if it was SSH configuration issue then it shouldn't work at all. But in our case it works after 10-15 minutes.
I think in our case it might be too many simultaneous connections to same server (or same repo) or something like that. Does there exists a setting or a conf file that needs to modified to solve this problem?
Please help me solve this problem or point me in the right direction.
Thanks in advance.
Pritam.
This question is related to this one. I'm not sure if this ever got moved to ServerFault, or if it was solved - there's no comments to that effect - so I'll add this answer.
Your issue is limited to accessing the git repository via SSH. This is because, by default, SSHD does not accommodate more than 10 simultaneous connections.
From man sshd_config page:
MaxSessions
Specifies the maximum number of open sessions permitted per net‐
work connection. The default is 10.
MaxStartups
Specifies the maximum number of concurrent unauthenticated con‐
nections to the SSH daemon. Additional connections will be
dropped until authentication succeeds or the LoginGraceTime
expires for a connection. The default is 10.
Alternatively, random early drop can be enabled by specifying the
three colon separated values “start:rate:full” (e.g. "10:30:60").
sshd(8) will refuse connection attempts with a probability of
“rate/100” (30%) if there are currently “start” (10) unauthenti‐
cated connections. The probability increases linearly and all
connection attempts are refused if the number of unauthenticated
connections reaches “full” (60).
If you haven't changed these, your server won't handle more than 10 simultaneous connections. Accessing your repositories via SSH does not take long; thus, continuously retrying will eventually connect as other peoples git push
es and git pull
s etc complete.
精彩评论