I have a script run by cron that rsync's various folders to a server in a different city to publish files to websites. In case it matters, the source server is within the corporate firewall and the destination server is outside.

The script uses a locking system to prevent multiple instances of itself running at the same time.

rsync is occasionally (up to 1-3 times per day) failing with the error:

rsync: read error: Connection reset by peer (104) rsync error: error in rsync protocol data stream (code 12) at io.c(604) [sender=2.6.9]

I found some advice suggesting that I specify a timeout value, so I added the flag --timeout=10 to the command. The result was a different error:

io timeout after 10 seconds -- exiting
rsync error: timeout in data send/receive (code 30) at io.c(165) [sender=2.6.9]

The receiving server likely has quite a heavy load, so that may be a factor.

Does anyone have any suggestions for avoiding these errors?

  • 4
    That's not related to rsync, it's related to your network configuration. To diagnose this, you'll need to know how all the firewalls between the two hosts are configured. --timeout didn't help because it fixes the symptom but not the cause: once the firewall has dropped the connection, --timeout makes rsync detect it faster, that's all. – Gilles 'SO- stop being evil' Jul 23 '13 at 23:31
  • I have seen similar issues on servers with very high I/O load. – jordanm Jul 24 '13 at 2:37
  • blog.iangreenleaf.com/2009/03/… discusses a workaround, the site has some formatting issues (at least the mobile view) but you can grasp the idea from the comments. – tripleee Jul 24 '13 at 5:35
  • I see this error when pause receiving rsync with KILL -TSTP – noonex Jul 18 '17 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.