current issues and debugging

  1. Q: Transfers die with something like

    rsync: error writing 4 unbuffered bytes - exiting: Broken pipe
    rsync error: error in rsync protocol data stream (code 12) at io.c(463)
    

    or

    rsync: connection unexpectedly closed (24 bytes read so far)
    rsync error: error in rsync protocol data stream (code 12) at io.c(342)
    

    A: This error tells you that the local rsync was trying to talk to the remote rsync, but the connection to that rsync is now gone. The thing you must figure out is why, and that can involve some investigative work.

    If the remote rsync is a daemon, your first step should be to look at the daemon's log file to see if it logged an error explaining why it aborted the transfer.

    Rsync 2.6.3 does a better job of retreiving the error from the remote process than older versions of rsync, so you may wish to try upgrading and see if you now get sent the error message from the remote rsync.

    There are several common causes for a remote rsync process going away:

    If you can't figure out why the failure happened, there are steps you can take to debug the situation. One way is to create a shell script on the remote system such as this one named "rsync-debug". You would use the script like this:

    rsync -av --rsync-path=/some/path/rsync-debug HOST:SOURCE DEST
    rsync -av --rsync-path=/some/path/rsync-debug SOURCE HOST:DEST
    

    This script enables core dumps and also logs all the OS system calls that lead up to the failure to a file in the /tmp dir. You can use the resulting files to help figure out why the remote rsync failed.

    If you are rsyncing to an rsync daemon, the above script won't have any effect. Instead, halt the current daemon and run a debug version with core-dumps enabled and (if desired) using a system-call tracing utility such as strace, truss, or tusc. For strace, you would do it like this (the -f option tells strace to follow the child processes too):

    ulimit -c unlimited
    strace -f rsync --daemon --no-detach 2>/tmp/rsync-$$.out
    

    Then, use a separate window to actually run the failing transfer, after which you can kill the debug rsync daemon (pressing Ctrl-C should do it).

    If you are using rsync under inetd, I'd suggest temporarily disabling that and using the above daemon approach to debug what is going on.

  2. Q: When connecting to an rsync daemon (using the "::" syntax) the connection fails immediately with an error like this:

    rsync: connection unexpectedly closed (24 bytes read so far)
    rsync error: error in rsync protocol data stream (code 12) at io.c(342)
    

    A: Older rsync daemons (before 2.6.3) were unable to return errors that were generated during the option-parsing phase of the transfer. Look in the logfile on the server to see if an error was reported, such as a "refused" option, an option that the server rsync doesn't support (e.g. perhaps links are not supported by the server), or some other failure (such as trying to send data to a read-only module). Upgrading the version of rsync that is running as a daemon to at least 2.6.3 will allow these errors to get returned to all rsync clients, old or new alike.

  3. Q: Using --dry-run (-n) doesn't show all changed directories.

    A: Correct. Rsync shows most other changes, but some directory changes are not currently described in --dry-run mode. Hopefully a future version will fix this.

  4. Q: Aren't there more issues than this?

    A: Yes. You can find some of them in the TODO file or search the bugzilla database.