summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2016-03-08 13:41:58 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-08 05:53:49 -0800
commit4318354aac650c18b4047142e43f3d4cff4310a7 (patch)
treea3521d218c4f24060c0b6647e4dc3ab7f209d41a /geo-replication/syncdaemon
parent325e62cc01a836058622d6ca8e534c352f954848 (diff)
geo-rep: Fix CPU utilization 100% with Popen
Errorstore is maintained by Geo-rep to collect errors from the child processes opened using Popen. If Popen.communicate is used then it closes stderr. When stderr is not available errorstore.tailer() will enter into infinite loop without gap. With this patch, sleep time added when stderr of Child process is already closed. Change-Id: Ic36aabd6de35b259467d0bab7952468432867a94 BUG: 1315601 Signed-off-by: Aravinda VK <avishwan@redhat.com> Reviewed-on: http://review.gluster.org/13637 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kotresh HR <khiremat@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'geo-replication/syncdaemon')
-rw-r--r--geo-replication/syncdaemon/resource.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
index 14fd76a7d59..c26054ad9df 100644
--- a/geo-replication/syncdaemon/resource.py
+++ b/geo-replication/syncdaemon/resource.py
@@ -152,6 +152,9 @@ class Popen(subprocess.Popen):
poe, _, _ = select(
[po.stderr for po in errstore], [], [], 1)
except (ValueError, SelectError):
+ # stderr is already closed wait for some time before
+ # checking next error
+ time.sleep(0.5)
continue
for po in errstore:
if po.stderr not in poe:
@@ -164,6 +167,7 @@ class Popen(subprocess.Popen):
try:
fd = po.stderr.fileno()
except ValueError: # file is already closed
+ time.sleep(0.5)
continue
l = os.read(fd, 1024)
if not l: