rsyserr is occasionally dropping receiver messages

Mike Bombich mike at bombich.com
Wed Mar 11 04:17:36 GMT 2009


Typically rsync exits and reports an error such as:

rsync: writefd_unbuffered failed to write 4 bytes [sender]: Broken  
pipe (32)
rsync: write failed on "/Volumes/Backup/big_file.dmg": No space left  
on device (28)
rsync: connection unexpectedly closed (67174 bytes received so far)  
[sender]
rsync error: error in rsync protocol data stream (code 12) at /src/ 
rsync-3.0.5/io.c(600) [sender=3.0.5]

when it runs out of space on the destination.  On a few occasions,  
however, I've seen the ENOSPC error not getting printed.  I was able  
to reproduce this occasionally, but consistently when the file that  
causes the error was very large (e.g. 5GB) and the space available on  
the destination was moderate (e.g. 700MB free space resulted in the  
error not being displayed, whereas only 300MB resulted in the error  
correctly being displayed), and the file already existed on the  
destination and was modified on the source (--no-inplace).

Oddly, I can tell that the ENOSPC message is always sent to rsyserr(),  
it just wasn't actually printed.  I added some fprintf lines to  
receive_data in receive.c and rsyserr in log.c (basically dumping the  
message that is sent to rsyserr preceded by the function name) and got  
this output:

+receive_data(): big_file.dmg [No space left on device]
+rsyserr(): write failed on %s [No space left on device]
+rsyserr(): writefd_unbuffered failed to write %ld bytes [%s] [Broken  
pipe]
rsync: writefd_unbuffered failed to write 4 bytes [sender]: Broken  
pipe (32)
rsync: connection unexpectedly closed (67174 bytes received so far)  
[sender]
rsync error: error in rsync protocol data stream (code 12) at /src/ 
rsync-3.0.5/io.c(600) [sender=3.0.5]


I'm using the patch below as a temporary workaround, but I'm curious  
if anyone has insight as to why rsyserr might not be printing these  
messages from the receiver.

Mike



diff -Naur -X rsync3/_build/diff_ignore rsync-3.0.5_base/receiver.c  
rsync-3.0.5/receiver.c
--- rsync-3.0.5_base/receiver.c	2008-11-15 16:49:28.000000000 -0600
+++ rsync-3.0.5/receiver.c	2009-03-10 22:18:20.000000000 -0500
@@ -297,6 +315,16 @@

  	if (fd != -1 && offset > 0 && sparse_end(fd) != 0) {
  	    report_write_error:
+		fprintf(stderr, "rsync: write failed on %s: %s\n",  
full_fname(fname), strerror(errno));
  		rsyserr(FERROR_XFER, errno, "write failed on %s",
  			full_fname(fname));
  		exit_cleanup(RERR_FILEIO);



More information about the rsync mailing list