[Bug 2420] New: Race condition regarding ControlPersist and ControlMaster=auto

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Fri Jul 3 16:48:17 AEST 2015


            Bug ID: 2420
           Summary: Race condition regarding ControlPersist and
           Product: Portable OpenSSH
           Version: 6.6p1
          Hardware: amd64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: ssh
          Assignee: unassigned-bugs at mindrot.org
          Reporter: dominik.klein at gmail.com

There seems to be a race condition in ssh between looking for an
available control socket and actually using it. If in between those 2
steps the socket is removed by the original ssh client because
ControlPersist timed out, the socket will be gone by the time ssh tries
to use it and so ssh fails to connect.

How to reproduce:

* ssh -o ControlMaster=auto -o ControlPersist=$timeout -o
ControlPath=$controlpath $server
* exit
* sleep $timeout
* ssh -o ControlMaster=auto -o ControlPersist=$timeout -o
ControlPath=$controlpath $server

The second ssh client will occasionally (when the race condition hit)
say sth like

debug1: auto-mux: Trying existing master
debug1: Control socket
"/home/klein/.ansible/cp/ansible-ssh-alice-22-klein" does not exist

I am not a programmer, I did not read any code and I do not know the
ssh client code. But my assumptions seems proven to me by those logs. 

My idea for a fix would be to look for a socket, if found, find the
original ssh process, talk to it, tell it to keep the socket open
because I want to use it and then use the socket. Not sure whether
that's doable and that's just to be taken as an administrator's, not a
programmer's idea.

You are receiving this mail because:
You are watching the assignee of the bug.

More information about the openssh-bugs mailing list