System: Linux 2.4.18, openssh-3.4p1 Problem: I use "ssh" and "tar" to backup remote directory trees to a local hard-disk/file-system: # ssh remote.server.org "tar -cz /home" >/backup/remote.tar.gz If the backup-file-system runs out of space before the backup completes, ssh starts hanging (waiting for the stdout-write to complete). Analysis: In this example it is of course very unlikely, that some space on the backup-file-system will be freed so that the backup can finish. Instead I would expect ssh to abort with an error, perhaps after some grace time. On the other hand there *may* be other situations, where one expects ssh to hang as it does. But since I am not aware of such an other situation, I consider this as a bug. Comments: ? Olaf Rogalsky -- +----------------------------------------------------------------------+ I Dipl. Phys. Olaf Rogalsky Institut f. Theo. Physik I I I Tel.: 09131 8528440 Univ. Erlangen-Nuernberg I I Fax.: 09131 8528444 Staudtstrasse 7 B3 I I rogalsky at theorie1.physik.uni-erlangen.de D-91058 Erlangen I +----------------------------------------------------------------------+
Seems to me that ssh doesn't know that stdout is going to a filesystem and so can't automaticly abort... However, the shell might (should?) break the redirection and send SIGPIPE once the filesystem is full? -Rob On Tue, 24 Sep 2002, Olaf Rogalsky wrote:> System: Linux 2.4.18, openssh-3.4p1 > > Problem: > I use "ssh" and "tar" to backup remote directory trees to a local > hard-disk/file-system: > # ssh remote.server.org "tar -cz /home" >/backup/remote.tar.gz > > If the backup-file-system runs out of space before the backup > completes, ssh starts hanging (waiting for the stdout-write to > complete). > > Analysis: > In this example it is of course very unlikely, that some space on the > backup-file-system will be freed so that the backup can finish. > Instead I would expect ssh to abort with an error, perhaps after some > grace time. > On the other hand there *may* be other situations, where one expects ssh > to hang as it does. But since I am not aware of such an other situation, > I consider this as a bug. > > Comments: ? > > Olaf Rogalsky > >
On Tue, Sep 24, 2002 at 06:01:41PM +0200, Olaf Rogalsky wrote:> System: Linux 2.4.18, openssh-3.4p1 > > Problem: > I use "ssh" and "tar" to backup remote directory trees to a local > hard-disk/file-system: > # ssh remote.server.org "tar -cz /home" >/backup/remote.tar.gzwhat happens if you # ssh remote.server.org "tar -cz /home" | cat > /backup/remote.tar.gz
Markus Friedl wrote:> what happens if you > # ssh remote.server.org "tar -cz /home" | cat > /backup/remote.tar.gzssh still hangs, but now cat gives an error message: cat: write error: No space left on device It is realy ssh, that hangs, since the following #ssh remote.server.org "tar -cz /home" | (cat > /backup/remote.tar.gz || echo ready) gives cat: write error: No space left on device ready PS: I also tried it under AIX (IBM UNIX) and different shells -- no difference. -- +----------------------------------------------------------------------+ I Dipl. Phys. Olaf Rogalsky Institut f. Theo. Physik I I I Tel.: 09131 8528440 Univ. Erlangen-Nuernberg I I Fax.: 09131 8528444 Staudtstrasse 7 B3 I I rogalsky at theorie1.physik.uni-erlangen.de D-91058 Erlangen I +----------------------------------------------------------------------+
Markus Friedl wrote:> i think it's because ssh still can read from the stdin > > what happens if you do this: > > # ssh -n remote.server.org "tar -cz /home" > /backup/remote.tar.gzUnfortunately still hanging. The next thing I did, was looking at source and running ssh with option "-vv" (should have done this long before :-). This is the relavant message: debug1: channel 0: write failed It stems from a line in function channel_handle_wfd(channels.c:1294): chan_write_failed(c); As expected, "errno" equals "ENOSPC" at this point. I wonder, if it wasn't wise to abort ssh at this point? PS: A bit offtopic: Why isn't it allowed/possible to close stdin with # ssh remote "echo test" <&- -- +----------------------------------------------------------------------+ I Dipl. Phys. Olaf Rogalsky Institut f. Theo. Physik I I I Tel.: 09131 8528440 Univ. Erlangen-Nuernberg I I Fax.: 09131 8528444 Staudtstrasse 7 B3 I I rogalsky at theorie1.physik.uni-erlangen.de D-91058 Erlangen I +----------------------------------------------------------------------+
Hi! On Wed, Sep 25, 2002 at 09:46:21PM +0200, Markus Friedl wrote:> On Tue, Sep 24, 2002 at 06:01:41PM +0200, Olaf Rogalsky wrote: > what happens if you > # ssh remote.server.org "tar -cz /home" | cat > /backup/remote.tar.gzFWIW, I could reproduce the problem, but only with protocol version 2: $ ssh -2 sub2 tar cf - . | head | wc 10 58 1294 [hangs] Using ssh -1, ssh does not hang: $ ssh -1 sub2 tar cf - . | head | wc 10 58 1294 Write failed flushing stdout buffer. write stdout: Broken pipe Stuff related to channel 0 from ssh -2 -v -v -v: debug1: channel 0: new [client-session] debug3: ssh_session2_open: channel_new: 0 debug1: send channel open 0 debug1: channel request 0: x11-req debug1: channel request 0: exec debug1: channel 0: open confirm rwindow 0 rmax 32768 debug2: channel 0: rcvd adjust 131072 debug1: channel 0: write failed debug1: channel 0: close_write debug1: channel 0: output open -> closed HTH. Ciao Thomas