diff options
author | Aravinda VK <avishwan@redhat.com> | 2016-03-08 13:41:58 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2016-03-08 08:32:39 -0800 |
commit | c249931f2ca37d56391e671b37479555fec92686 (patch) | |
tree | 6658fa8e541fa137b2838d7649af485afc847985 | |
parent | 67704349dff995436ed4db8c8da55648e40c7388 (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: 1315582
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/13637
Reviewed-on: http://review.gluster.org/13645
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index ac697eb39ed..c7fdbf37308 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: |