4
rsync --protocol=29 -rav -e ssh --include '*/' --include='*_en*.xml.gz' --exclude='*' user@server:/path/

Content is downloading from remote server but after while I get this error:

Write failed: Connection reset by peer
rsync: connection unexpectedly closed (39027627 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [receiver=3.0.9]
rsync: connection unexpectedly closed (149869 bytes received so far) [generator]
rsync error: unexplained error (code 255) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [generator=3.0.9]

Any ideas why this happens?

3 Answers 3

3

Something is breaking up your network connection. It could be any network device between the local machine and the remote machine. For example, some overloaded firewalls tend to drop connections somewhat randomly. Diagnosing this requires a good knowledge of the network topology.

Rsync connections are mostly easy to resume when the underlying TCP connection drops: just run it again. As long as each run has time to transfer at least one complete files, it'll finish the job eventually.

In general, you can build a more reliable TCP connection on top of a less reliable one, but I don't know of any turnkey solution. Some VPN software may work well for this. Rocks is an old, unmaintained tool to do precisely this.

See also The most *robust* remote file copy? and Automatically-reconnecting TCP tunnel

2
  • I think its problem using rsync from cygwin. When I executed same command from linux machine it worked fine. Commented Sep 26, 2014 at 10:31
  • You can use --partial (aka -P) to remove the need to have synced at least one complete file. Commented Jun 8, 2015 at 15:08
1

I had the same problem recently using rsync 3.1.1 (and 3.0.9) under cygwin and pulling from a remote linux machine (rsync 3.1.0). In my case it turned out to relate to spaces in the source path. The solution was to enclose the path in double quotes and then enclose this in single quotes e.g.

$ rsync [email protected]:'"Documents/016054 signed agreement.pdf"' $TEMP/file.pdf

Leaving out the single and/or the double quotes causes failure. Note that the quotes go around the directory/file and not around the user/machine.

0

Apart from network problems, and rsync protocol problems, you also may be trying to synchronize so many files at once, that you run out of memory.

You didn't write anything about your environment, so I just guess. But similar problems arise, when you rsync many files from/to OpenVZ container and you suddenly run out of PRIVVMPAGES.

To check, if it's related to memory, just try to rsync a single, big file.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.