Thanks for taking the time to report the bug and make Ubuntu better. I can reproduce the bug using your testcase, but that requires a VM with a graphical environment installed. Another way to reproduce the bug is (from the upstream bug report):
$ lxc launch ubuntu-daily:jammy ssh-cpu $ lxc shell ssh-cpu # ssh HOST 2> >({exec 1>&2}) You can shell into the container from another terminal and use "htop" to verify that ssh is using 100% of one of the CPU cores. This seems to have been fixed upstream by the following commit: https://github.com/openssh/openssh- portable/commit/d6556de1db0822c76ba2745cf5c097d9472adf7c I confirmed that this only happens on Jammy. Focal and Kinetic are not affected. ** Also affects: openssh (Ubuntu Jammy) Importance: Undecided Status: New ** Changed in: openssh (Ubuntu) Status: New => Fix Released ** Changed in: openssh (Ubuntu Jammy) Status: New => Triaged ** Changed in: openssh (Ubuntu Jammy) Importance: Undecided => Medium ** Bug watch added: OpenSSH Portable Bugzilla #3405 https://bugzilla.mindrot.org/show_bug.cgi?id=3405 ** Also affects: openssh via https://bugzilla.mindrot.org/show_bug.cgi?id=3405 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to openssh in Ubuntu. https://bugs.launchpad.net/bugs/1986521 Title: ssh client spins if output fd closed Status in portable OpenSSH: Unknown Status in openssh package in Ubuntu: Fix Released Status in openssh source package in Jammy: Triaged Bug description: The OpenSSH package 8.9p1 as shipped with U22.04 (8.9p1-3) suffers from the bug described at https://bugzilla.mindrot.org/show_bug.cgi?id=3411 and https://bugzilla.mindrot.org/show_bug.cgi?id=3405 A command such as "xterm -e 'ssh -f remote.host sleep 60'" will pop up an xterm, ask for whatever authentication is needed, close the xterm, and leave the ssh client spinning consuming CPU time for 60 seconds before it exits. It should leave the ssh client idle for 60 seconds. Many uses of ssh to launch graphical applications will be caught by this bug. This is fixed in OpenSSH 9.0p1 as the first bugfix listed in its release notes at https://www.openssh.com/txt/release-9.0 To manage notifications about this bug go to: https://bugs.launchpad.net/openssh/+bug/1986521/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp