Jan Schermer
2025-Oct-07 07:39 UTC
Terminal input lags behind when using mux with OpenSSH 10.1p1 + macOS 26.1b2
Hello, I just upgraded openssh on my laptop using homebrew to 10.1p1 and macOS to developer beta 2 and it no longer works right. At first I thought it was lag, but it is actually ssh waiting for input of several (more) characters before it both displays output or executes remote commands (input). It onlly happens if 10.1p1 is the version running the master mux. When macOS default client (OpenSSH_10.0p2 in this version) is the one hosting the master, then everything works fine. Vice versa, when OpenSSH_10.0p2 is the one attaching to 10.1p1 socket running the master then it lags. I have narrowed the problem down to simply using or not using ControlMaster (ControlPath=socket vs ControlPath=none). Tested with several versions of remote sshd on Debian, Ubuntu and FreeBSD and ssh client in iTerm2 and Terminal.app without change. Recompiling from source with newest Xcode on 26.1b2 didn?t fix it. Unfortunately I don?t have a non-beta OS to test. Let me know how I can help debug this or if someone can replicate it. Thanks Jan
Damien Miller
2025-Oct-07 08:34 UTC
Terminal input lags behind when using mux with OpenSSH 10.1p1 + macOS 26.1b2
On Tue, 7 Oct 2025, Jan Schermer wrote:> Hello, I just upgraded openssh on my laptop using homebrew to 10.1p1 > and macOS to developer beta 2 and it no longer works right. > > At first I thought it was lag, but it is actually ssh waiting for >input of several (more) characters before it both displays output or >executes remote commands (input). > > It onlly happens if 10.1p1 is the version running the master mux. > When macOS default client (OpenSSH_10.0p2 in this version) is the > one hosting the master, then everything works fine. Vice versa, when > OpenSSH_10.0p2 is the one attaching to 10.1p1 socket running the > master then it lags. > > I have narrowed the problem down to simply using or not using > ControlMaster (ControlPath=socket vs ControlPath=none). Tested with > several versions of remote sshd on Debian, Ubuntu and FreeBSD and ssh > client in iTerm2 and Terminal.app without change. Recompiling from > source with newest Xcode on 26.1b2 didn?t fix it. Unfortunately I > don?t have a non-beta OS to test.Yes, this is https://bugzilla.mindrot.org/show_bug.cgi?id=3872 I've just committed a fix on the V_10_1 branch to fix this, also below. commit beae06f56e0d0a66ca535896149d5fb0b2e8a1b4 Author: djm at openbsd.org <djm at openbsd.org> Date: Tue Oct 7 08:02:32 2025 +0000 upstream: don't reuse c->isatty for signalling that the remote channel has a tty attached as this causes side effects, e.g. in channel_handle_rfd(). bz3872 ok markus@ OpenBSD-Commit-ID: 4cd8a9f641498ca6089442e59bad0fd3dcbe85f8 diff --git a/channels.c b/channels.c index f1d7bcf34..80014ff34 100644 --- a/channels.c +++ b/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.451 2025/09/25 06:33:19 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.452 2025/10/07 08:02:32 djm Exp $ */ /* * Author: Tatu Ylonen <ylo at cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland @@ -362,7 +362,7 @@ channel_classify(struct ssh *ssh, Channel *c) { struct ssh_channels *sc = ssh->chanctxt; const char *type = c->xctype == NULL ? c->ctype : c->xctype; - const char *classifier = c->isatty ? + const char *classifier = (c->isatty || c->remote_has_tty) ? sc->bulk_classifier_tty : sc->bulk_classifier_notty; c->bulk = type != NULL && match_pattern_list(type, classifier, 0) == 1; @@ -566,7 +566,7 @@ channel_new(struct ssh *ssh, char *ctype, int type, int rfd, int wfd, int efd, void channel_set_tty(struct ssh *ssh, Channel *c) { - c->isatty = 1; + c->remote_has_tty = 1; channel_classify(ssh, c); } @@ -1078,7 +1078,8 @@ channel_format_status(const Channel *c) c->rfd, c->wfd, c->efd, c->sock, c->ctl_chan, c->have_ctl_child_id ? "c" : "nc", c->ctl_child_id, c->io_want, c->io_ready, - c->isatty ? "T" : "", c->bulk ? "B" : "I"); + c->isatty ? "T" : (c->remote_has_tty ? "RT" : ""), + c->bulk ? "B" : "I"); return ret; } diff --git a/channels.h b/channels.h index df7c7f364..7456541f8 100644 --- a/channels.h +++ b/channels.h @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.h,v 1.161 2025/09/25 06:33:19 djm Exp $ */ +/* $OpenBSD: channels.h,v 1.162 2025/10/07 08:02:32 djm Exp $ */ /* * Author: Tatu Ylonen <ylo at cs.hut.fi> @@ -145,6 +145,7 @@ struct Channel { int ctl_chan; /* control channel (multiplexed connections) */ uint32_t ctl_child_id; /* child session for mux controllers */ int have_ctl_child_id;/* non-zero if ctl_child_id is valid */ + int remote_has_tty; /* remote side has a tty */ int isatty; /* rfd is a tty */ #ifdef _AIX int wfd_isatty; /* wfd is a tty */