ssh ConnectTimeout is obeyed only on 1st ConnectionAttempt

Bug #1798049 reported by Vide
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

This seems a regression from Ubuntu 17.10 OpenSSH 7.5.

Setting the SSH option ConnectTimeout=N only works on the first ConnectionAttempts. So, if you set ConnectionAttempts=2 for example, it will time out after N second on the first attempt and wait the full, default TCP timeout on the second attempt.

Example of the error:

$ time ssh -vvvv -o ConnectTimeout=2 -o ConnectionAttempts=2 -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null 1.2.3.4
OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/vide/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "1.2.3.4" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 1.2.3.4 [1.2.3.4] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 1.2.3.4 port 22: Connection timed out
debug1: Trying again...
debug1: Connecting to 1.2.3.4 [1.2.3.4] port 22.
debug1: connect to address 1.2.3.4 port 22: Connection timed out
ssh: connect to host 1.2.3.4 port 22: Connection timed out

real 2m13,670s
user 0m0,012s
sys 0m0,018s

The first timeout happens after 2 seconds, the second after ~2 minutes

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: openssh-client 1:7.6p1-4
ProcVersionSignature: Ubuntu 4.15.0-34.37-generic 4.15.18
Uname: Linux 4.15.0-34-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.4
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue Oct 16 10:48:41 2018
InstallationDate: Installed on 2017-11-20 (329 days ago)
InstallationMedia: Ubuntu 17.10 "Artful Aardvark" - Release amd64 (20171018)
RelatedPackageVersions:
 ssh-askpass N/A
 libpam-ssh N/A
 keychain N/A
 ssh-askpass-gnome N/A
SSHClientVersion: OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n 7 Dec 2017
SourcePackage: openssh
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Vide (vide80) wrote :
Revision history for this message
Vide (vide80) wrote :

I've opened a bug report upstream https://bugzilla.mindrot.org/show_bug.cgi?id=2918 because friends not using Ubuntu confirmed the same erratic behavior even with newer OpenSSH versions (7.8)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openssh - 1:8.0p1-2

---------------
openssh (1:8.0p1-2) experimental; urgency=medium

  * Fix interop tests for recent regress changes.

 -- Colin Watson <email address hidden> Fri, 14 Jun 2019 14:32:12 +0100

Changed in openssh (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.