Disable closing idle Ssh connections again
By switching to Apache SSHD 0.6.0 in
812a823569
, we started to close idle Ssh
connections after 10 minutes of inactivity (See r1163164 of Apache
SSHD). This closing of idle connections caused problems for scripts
that listened for streamed events. Even though the scripts
reconnected, and gerrit accepted the connection attempts, sometimes no
events got passed through the new connections and the task queue
started to fill up.
Until we can isolate the root cause of the problem, we revert to the
old behaviour of not closing idle connections, and thereby mitigate
the problem.
Additionally, we allow to configure the idle timeout.
Change-Id: Ia4f226771b082057ecb45e6c2a9a8d809ec1389d
This commit is contained in:
parent
ca4db4eea0
commit
3d79459578
@ -2368,6 +2368,20 @@ unit suffixes to express their setting:
|
||||
+
|
||||
By default, 2 minutes.
|
||||
|
||||
[[sshd.idleTimeout]]sshd.idleTimeout::
|
||||
+
|
||||
Time in seconds after which the server automatically terminates idle
|
||||
connections (or 0 to disable closing of idle connections). Values
|
||||
should use common unit suffixes to express their setting:
|
||||
+
|
||||
* s, sec, second, seconds
|
||||
* m, min, minute, minutes
|
||||
* h, hr, hour, hours
|
||||
* d, day, days
|
||||
|
||||
+
|
||||
By default, 0.
|
||||
|
||||
[[sshd.maxConnectionsPerUser]]sshd.maxConnectionsPerUser::
|
||||
+
|
||||
Maximum number of concurrent SSH sessions that a user account
|
||||
|
@ -152,6 +152,18 @@ public class SshDaemon extends SshServer implements SshInfo, LifecycleListener {
|
||||
String.valueOf(MILLISECONDS.convert(ConfigUtil.getTimeUnit(cfg, "sshd",
|
||||
null, "loginGraceTime", 120, SECONDS), SECONDS)));
|
||||
|
||||
long idleTimeoutSeconds = ConfigUtil.getTimeUnit(cfg, "sshd", null,
|
||||
"idleTimeout", 0, SECONDS);
|
||||
if (idleTimeoutSeconds == 0) {
|
||||
// Since Apache SSHD does not allow to turn off closing idle connections,
|
||||
// we fake it by using the highest timeout allowed by Apache SSHD, which
|
||||
// amounts to ~24 days.
|
||||
idleTimeoutSeconds = MILLISECONDS.toSeconds(Integer.MAX_VALUE);
|
||||
}
|
||||
getProperties().put(
|
||||
IDLE_TIMEOUT,
|
||||
String.valueOf(SECONDS.toMillis(idleTimeoutSeconds)));
|
||||
|
||||
final int maxConnectionsPerUser =
|
||||
cfg.getInt("sshd", "maxConnectionsPerUser", 64);
|
||||
if (0 < maxConnectionsPerUser) {
|
||||
|
Loading…
Reference in New Issue
Block a user