From 22cf3d78513e6265246ae40186aec6f260cc86ee Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 1 Sep 2016 12:35:46 +0530 Subject: [PATCH 82/86] 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. > 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 > Reviewed-on: http://review.gluster.org/15442 > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Saravanakumar Arumugam BUG: 1340756 Change-Id: I9cfce116e8aafa4a98654f5190d40a455af8ec95 Signed-off-by: Aravinda VK Reviewed-on: https://code.engineering.redhat.com/gerrit/85007 Reviewed-by: Atin Mukherjee Tested-by: Atin Mukherjee --- geo-replication/syncdaemon/resource.py | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index b451f73..3a9aa33 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -170,7 +170,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) @@ -205,6 +211,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: -- 1.7.1