SSH connection hanging on logout

Damien Miller djm at mindrot.org
Thu May 10 12:33:51 EST 2001


On 8 May 2001, John Bowman wrote:

> As is well known, current versions of openssh hang upon exit when
> background processes exist.
>
> If these processes do not produce output to stdout or stderr they should be
> allowed to continue to run silently.  (If they do try to produce output,
> they will be killed by the shell.)  This would be consistent with the
> behaviour of rsh, ssh, rlogin, telnet, csh, and bash.  In no case should
> openssh wait around for them indefinitely.
>
> Ssh is supposed to be a secure implementation of rsh and openssh is
> supposed to be a open source version of ssh, so despite a few suggestions
> to the contrary, this *really* is a bug.
>
> The following patch to openssh-2.9p1 fixes the problem. This patch has now
> been thoroughly tested and is believed not to break ssh or scp, unlike
> previous related attempts.

The patch does not work for protocol 1:

while [ 1 ] ; do ssh -p 2222 -o Protocol=1 -oForwardX11=no djm at localhost dd if=/dev/zero bs=1024 count=100 | wc -c ; done

Write failed flushing stdout buffer.
100+0 records in
100+0 records out
  16384
Write failed flushing stdout buffer.
100+0 records in
100+0 records out
  20480
Write failed flushing stdout buffer.
100+0 records in
100+0 records out
  20480
Write failed flushing stdout buffer.
100+0 records in
100+0 records out
  20480

etc

-- 
| Damien Miller <djm at mindrot.org> \ ``E-mail attachments are the poor man's
| http://www.mindrot.org          /   distributed filesystem'' - Dan Geer




More information about the openssh-unix-dev mailing list