SSH freezing with ControlPersist on
I recently enabled ControlMaster
and ControlPersist
in SSH so that it reuses and multiplexes connections for speed. The config is:
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
ControlPersist 4h
If I turn ControlPersist
off, everything is fine. With it on, though, the first git/hg connection will always freeze. SSHing in normally (in a shell) works fine, ever for the first time, but git/hg freezes. If I stop it with ctrl+C and then retry, it will use the already-established connection to multiplex and it will be fast, but it won't do it the first time. Turning LogLevel
up to 11 gives me:
remote: debug2: fd 4 setting O_NONBLOCK
remote: debug1: forking to background
remote: debug1: Entering interactive session.
remote: debug2: set_control_persist_exit_time: schedule exit in 14400 seconds
remote: debug1: multiplexing control connection
remote: debug2: fd 5 setting O_NONBLOCK
at which point, it just freezes and stays there for ever. What's wrong?
Solution 1:
I'm seeing the same behavior, and I think it is due to this OpenSSH bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1988 (ControlPersist causes stderr to be left open until the master connection times out)
Hopefully it will be fixed eventually.