Reduce socket connect timeout in nodescan

During nodescan we currently set a socket timeout which is equal to
the timeout we wait for the entire boot. In case we have unfortunate
timing of the network interface setup of the node (especially Windows
does this very late in the boot process) we get longer wait times than
necessary. This happens because uninitialized network interfaces on
the node lead to unanswered syn packets instead of connection refused
errors. Linux typically does around 6 syn retries with an exponential
backof starting with 3s. This means the delay between syn retries is
3, 6, 12 seconds and thus in absolute time a single socket connect can
return after 0, 3, 6, 12, 45, 93 or 189 seconds.

This can be solved by setting a fixed lower timeout on the socket to
force it to return with timeout after 10s so we can avoid the
exponential syn retry backoff and thus don't waste too much time on
slower starting nodes.

Change-Id: Ibabdff1966d49752e86e15a1c2a24dd2c86d33f6
Tobias Henkel 5 years ago
parent ad49f5421c
commit e925327309
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2

@ -82,7 +82,7 @@ def nodescan(ip, port=22, timeout=60, gather_hostkeys=True):
t = None
sock = socket.socket(family, socket.SOCK_STREAM)
if gather_hostkeys:
t = paramiko.transport.Transport(sock)