From c0f877c0374d97e0bee17aac4850d7655a35e61b Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 1 Sep 2016 12:35:46 +0530 Subject: geo-rep: Fix logging sync failures If Rsync/Tar subprocess dies, while logging error Geo-rep fails with EBADF while accessing error file. Also worker dies while accessing elines before it is set. BUG: 1372193 Change-Id: I9cfce116e8aafa4a98654f5190d40a455af8ec95 Signed-off-by: Aravinda VK Reviewed-on: http://review.gluster.org/15379 NetBSD-regression: NetBSD Build System Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Kotresh HR --- geo-replication/syncdaemon/resource.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'geo-replication') diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 00bf4cb9d5c..ddbf19688c5 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -169,7 +169,13 @@ class Popen(subprocess.Popen): except ValueError: # file is already closed time.sleep(0.5) continue - l = os.read(fd, 1024) + + try: + l = os.read(fd, 1024) + except OSError: + time.sleep(0.5) + continue + if not l: continue tots = len(l) @@ -204,6 +210,7 @@ class Popen(subprocess.Popen): kw['close_fds'] = True self.lock = threading.Lock() self.on_death_row = False + self.elines = [] try: sup(self, args, *a, **kw) except: -- cgit