To reproduce: in one terminal: test$ ssh host -MS /tmp/test <<do a full login>> in a second terminal on the same machine (2.2.2.2 is an unresponsive host): test$ ssh 0 -S /tmp/test -W 2.2.2.2:22 ^C << hit control-c >> test$ ssh 0 -S /tmp/test -W 2.2.2.2:22 <<wait about 90 seconds for ssh to timeout and exit>> test$ ssh 0 -S /tmp/test -W localhost:22 Now, the ssh from terminal one and two will exit immediately. The error in terminal 1 is: channel_by_id: 3: bad id: channel free Disconnecting: Received open failure for non-opening channel 3.
There are a few problems here: 1) Not cancelling the delayed connect when the first slave connection closes 2) Reusing channel IDs while there might still be operations pending on the server for previously-closed ones 3) Disconnecting for something that could probably be ignored
This fixes it for me on the openssh 6.1p1 tree: change mux.c:226 from if (sc->type != SSH_CHANNEL_OPEN) { to: if (sc->type != SSH_CHANNEL_OPEN && sc->type != SSH_CHANNEL_OPENING) {
the change in comment #2 looks reasonable to me
Fix applied - this will be in OpenSSH 6.3. Thanks!
Close all resolved bugs after 7.3p1 release