autossh does not honor AUTOSSH_POLL environment variable

Bug #992110 reported by fidian on 2012-04-30
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
autossh (Debian)
New
Undecided
Unassigned
autossh (Ubuntu)
Undecided
Unassigned

Bug Description

Description: Ubuntu 11.10
Release: 11.10

autossh:
  Installed: 1.4b-6
  Candidate: 1.4b-6
  Version table:
 *** 1.4b-6 0
        500 http://us.archive.ubuntu.com/ubuntu/ oneiric/universe i386 Packages
        100 /var/lib/dpkg/status

It looks like AUTOSSH_POLL is not used unless AUTOSSH_FIRST_POLL is also used. See examples of me running it from the command line. You'll notice the "set alarm for XXX secs" messages. According to the documentation, if AUTOSSH_FIRST_POLL is not set, then it should default to AUTOSSH_POLL. That, plus AUTOSSH_POLL should have some effect if AUTOSSH_FIRST_POLL is not specified. The math in the second invocation is also wrong - net timeouts should be 1/2 of the short poll time; thus 1.5 seconds (or about there) instead of 1,500 seconds ... unless that's not seconds.

I started digging into why my ssh tunnels die because I've had an extremely high amount of problems today - I actually had terminals open and ssh was killed while I was typing into the remote shell. I still don't know why the connections are failing, but setting AUTOSSH_FIRST_POLL to AUTOSSH_POLL and keeping them both at 30 (double the default net timeout setting) seems to work for me.

12:59 Vubuntu:~$ AUTOSSH_DEBUG=1 AUTOSSH_POLL=30 autossh -M 63329 -qND 20005 -i /home/fidian/.ssh/id_rsa <email address hidden>
autossh[3733]: checking for grace period, tries = 0
autossh[3733]: starting ssh (count 1)
autossh[3733]: ssh child pid is 3736
autossh[3733]: check on child 3736
autossh[3733]: set alarm for 600 secs
autossh[3736]: execing /usr/bin/ssh
^Cautossh[3733]: received signal to exit (2)

13:00 Vubuntu:~$ AUTOSSH_DEBUG=1 AUTOSSH_POLL=3 autossh -M 63329 -qND 20005 -i /home/fidian/.ssh/id_rsa <email address hidden>
autossh[3764]: short poll time: adjusting net timeouts to 1500
autossh[3764]: checking for grace period, tries = 0
autossh[3764]: starting ssh (count 1)
autossh[3764]: ssh child pid is 3767
autossh[3764]: check on child 3767
autossh[3764]: set alarm for 600 secs
autossh[3767]: execing /usr/bin/ssh
^Cautossh[3764]: received signal to exit (2)

13:01 Vubuntu:~$ AUTOSSH_DEBUG=1 AUTOSSH_POLL=30 AUTOSSH_FIRST_POLL=5 autossh -M 63329 -qND 20005 -i /home/fidian/.ssh/id_rsa <email address hidden>
autossh[3777]: checking for grace period, tries = 0
autossh[3777]: starting ssh (count 1)
autossh[3777]: ssh child pid is 3780
autossh[3780]: execing /usr/bin/sshautossh[3777]: check on child 3780
autossh[3777]: set alarm for 5 secs
autossh[3777]: connection ok
autossh[3777]: check on child 3780
autossh[3777]: set alarm for 30 secs
autossh[3777]: connection ok
autossh[3777]: check on child 3780
autossh[3777]: set alarm for 30 secs
^Cautossh[3777]: received signal to exit (2)

13:11 Vubuntu:~$ AUTOSSH_DEBUG=1 AUTOSSH_POLL=10 AUTOSSH_FIRST_POLL=30 autossh -M 63329 -qND 20005 -i /home/fidian/.ssh/id_rsa <email address hidden>
autossh[4001]: short poll time: adjusting net timeouts to 5000
autossh[4001]: checking for grace period, tries = 0
autossh[4001]: starting ssh (count 1)
autossh[4001]: ssh child pid is 4004
autossh[4001]: check on child 4004
autossh[4001]: set alarm for 30 secs
autossh[4004]: execing /usr/bin/ssh
autossh[4001]: timeout polling to accept read connection
autossh[4001]: port down, restarting ssh
autossh[4001]: checking for grace period, tries = 0
autossh[4001]: starting ssh (count 2)
autossh[4001]: ssh child pid is 4010
autossh[4001]: check on child 4010
autossh[4001]: set alarm for 30 secs
autossh[4010]: execing /usr/bin/ssh
^Cautossh[4001]: received signal to exit (2)

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in autossh (Ubuntu):
status: New → Confirmed
Axel Huebl (axel-huebl) wrote :

I can confirm the problem, not only on Ubuntu but also on my fresh Ubuntu (wheezy).

I am using the following settings to work around the problem:
  export AUTOSSH_FIRST_POLL=5
  export AUTOSSH_POLL=60

Axel Beckert (xtaran) wrote :

I can confirm the findings, too. I first thought, the cause is that $AUTOSSH_FIRST_POLL does not default to $AUTOSSH_POLL from the environment, but to $AUTOSSH_POLL's default value, i.e. 600 seconds. But I couldn't confirm such a behaviour.

Unfortunately I haven't yet found the spot in the code which causes this behaviour.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers