2

我们在 VPS 帐户(CPU:2.68GHz RAM:1824MB)上有一个自托管的 git 服务器(Gitolite)。同样的 VPS 也用于发布我们开发不足的 Web 应用程序以进行客户端演示。(非常少的流量)。所以服务器的主要用途是仅作为 Git 服务器。

这个 git 服务器由 30-40 人的团队访问,用于各种项目。我们的问题是,当 6-7 人尝试访问服务器(有时是相同的仓库)时,我们会收到频繁的错误消息:

ssh: connect to host xxx.xxx.xx.xx port 22: Bad file number fatal: 远端意外挂断

尝试10-15分钟后,通常会成功。

在只有 1-2 人的清晨和深夜,git 命令以 100% 的成功率运行。另外我想指出,如果我通过 HTTP 访问服务器上托管的其他文件,它工作正常。

我在 StackOverflow 和其他网站上发现了一些关于此的问题。但大多数人认为是 SSH 密钥设置或 Msysgit 和 Cygns SSH 之间的冲突。

但是,我认为这不是我们案例中的问题,因为我们在 Windows(仅使用 msysgit)以及 Mac 机器上得到了这种行为。此外,如果它是 SSH 配置问题,那么它根本不应该工作。但在我们的例子中,它会在 10-15 分钟后起作用。

我认为在我们的情况下,可能有太多同时连接到同一服务器(或同一仓库)或类似的东西。是否存在需要修改以解决此问题的设置或 conf 文件?

请帮我解决这个问题或指出我正确的方向。

提前致谢。

普里塔姆。

4

1 回答 1

1

这个问题与这个有关。我不确定这是否已移至 ServerFault,或者是否已解决-对此没有任何评论-因此我将添加此答案。

您的问题仅限于通过 SSH 访问 git 存储库。这是因为,默认情况下,SSHD 不能容纳超过 10 个同时连接。

从 man sshd_config 页面:

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).

如果您没有更改这些,您的服务器将不会处理超过 10 个同时连接。通过 SSH 访问您的存储库不需要很长时间;因此,不断重试最终将在其他人git pushes 和git pulls etc 完成时连接。

于 2012-02-17T13:13:19.370 回答