3604df
From 22cf3d78513e6265246ae40186aec6f260cc86ee Mon Sep 17 00:00:00 2001
3604df
From: Aravinda VK <avishwan@redhat.com>
3604df
Date: Thu, 1 Sep 2016 12:35:46 +0530
3604df
Subject: [PATCH 82/86] geo-rep: Fix logging sync failures
3604df
3604df
If Rsync/Tar subprocess dies, while logging error Geo-rep fails
3604df
with EBADF while accessing error file. Also worker dies while
3604df
accessing elines before it is set.
3604df
3604df
> Reviewed-on: http://review.gluster.org/15379
3604df
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
> Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
> Reviewed-by: Kotresh HR <khiremat@redhat.com>
3604df
> Reviewed-on: http://review.gluster.org/15442
3604df
> Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
> Reviewed-by: Saravanakumar Arumugam <sarumuga@redhat.com>
3604df
3604df
BUG: 1340756
3604df
Change-Id: I9cfce116e8aafa4a98654f5190d40a455af8ec95
3604df
Signed-off-by: Aravinda VK <avishwan@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/85007
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
Tested-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 geo-replication/syncdaemon/resource.py |    9 ++++++++-
3604df
 1 files changed, 8 insertions(+), 1 deletions(-)
3604df
3604df
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
3604df
index b451f73..3a9aa33 100644
3604df
--- a/geo-replication/syncdaemon/resource.py
3604df
+++ b/geo-replication/syncdaemon/resource.py
3604df
@@ -170,7 +170,13 @@ class Popen(subprocess.Popen):
3604df
                         except ValueError:  # file is already closed
3604df
                             time.sleep(0.5)
3604df
                             continue
3604df
-                        l = os.read(fd, 1024)
3604df
+
3604df
+                        try:
3604df
+                            l = os.read(fd, 1024)
3604df
+                        except OSError:
3604df
+                            time.sleep(0.5)
3604df
+                            continue
3604df
+
3604df
                         if not l:
3604df
                             continue
3604df
                         tots = len(l)
3604df
@@ -205,6 +211,7 @@ class Popen(subprocess.Popen):
3604df
             kw['close_fds'] = True
3604df
         self.lock = threading.Lock()
3604df
         self.on_death_row = False
3604df
+        self.elines = []
3604df
         try:
3604df
             sup(self, args, *a, **kw)
3604df
         except:
3604df
-- 
3604df
1.7.1
3604df