From 15065dbaa494596dd2a5457fee18463facdfd0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Fri, 13 Jun 2014 20:07:01 +0200 Subject: [PATCH] Fix sporadic "Resource temporarily unavailable" error Issue reported on the mailing list while backing up to a remote repository on OS X over a slow uplink. --- CHANGES | 1 + attic/remote.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c86c0afd7..c80db7f71 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ Version 0.13 (feature release, released on X) +- Fix sporadic "Resource temporarily unavailable" when using remote repositories - Reduce file cache memory usage (#90) - Faster AES encryption (utilizing AES-NI when available) - Experimental Linux, OS X and FreeBSD ACL support (#66) diff --git a/attic/remote.py b/attic/remote.py index 91de21952..6c4a98ae7 100644 --- a/attic/remote.py +++ b/attic/remote.py @@ -1,3 +1,4 @@ +import errno import fcntl import msgpack import os @@ -195,7 +196,13 @@ class RemoteRepository(object): self.to_send = msgpack.packb((1, self.msgid, cmd, args)) if self.to_send: - self.to_send = self.to_send[os.write(self.stdin_fd, self.to_send):] + try: + self.to_send = self.to_send[os.write(self.stdin_fd, self.to_send):] + except OSError as e: + # io.write might raise EAGAIN even though select indicates + # that the fd should be writable + if e.errno != errno.EAGAIN: + raise if not self.to_send and not (calls or self.preload_ids): w_fds = [] self.ignore_responses |= set(waiting_for)