summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker
diff options
context:
space:
mode:
authorCsaba Henk <csaba@redhat.com>2012-06-13 14:15:14 +0530
committerAnand Avati <avati@redhat.com>2012-07-14 21:09:41 -0700
commit01fe42db6e185ee7eb59677af9bc5bdf174bf548 (patch)
tree35a8cbbe29c4a62f20ffa516b64e70aababfed5a /xlators/features/marker
parentb69a5928718c8236a32d4a6eaec600a01d5fcd99 (diff)
geo-rep / gsyncd: fixes to communication with child processes
due to not using the proper Python keyword, errhandler thread was possible to run into empty select Signed-off-by: Csaba Henk <csaba@redhat.com> BUG: 764678 Change-Id: I3c39e718e72545c27d50fd73aa6daf54062331b0 Reviewed-on: http://review.gluster.com/3560 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/marker')
-rw-r--r--xlators/features/marker/utils/syncdaemon/resource.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py
index b9c757b60..0cbbd4223 100644
--- a/xlators/features/marker/utils/syncdaemon/resource.py
+++ b/xlators/features/marker/utils/syncdaemon/resource.py
@@ -125,12 +125,12 @@ class Popen(subprocess.Popen):
continue
for po in errstore:
if po.stderr not in poe:
- next
+ continue
po.lock.acquire()
try:
- la = errstore.get(po)
- if la == None:
+ if po.on_death_row:
continue
+ la = errstore[po]
try:
fd = po.stderr.fileno()
except ValueError: # file is already closed
@@ -169,6 +169,7 @@ class Popen(subprocess.Popen):
if 'close_fds' not in kw:
kw['close_fds'] = True
self.lock = threading.Lock()
+ self.on_death_row = False
try:
sup(self, args, *a, **kw)
except:
@@ -177,7 +178,7 @@ class Popen(subprocess.Popen):
raise
raise GsyncdError("""execution of "%s" failed with %s (%s)""" % \
(args[0], errno.errorcode[ex.errno], os.strerror(ex.errno)))
- if kw['stderr'] == subprocess.PIPE:
+ if kw.get('stderr') == subprocess.PIPE:
assert(getattr(self, 'errhandler', None))
self.errstore[self] = []
@@ -212,16 +213,19 @@ class Popen(subprocess.Popen):
"""
self.lock.acquire()
try:
- elines = self.errstore.pop(self)
+ self.on_death_row = True
finally:
self.lock.release()
+ elines = self.errstore.pop(self)
if self.poll() == None:
self.terminate()
if self.poll() == None:
time.sleep(0.1)
- self.kill()
- self.wait()
+ self.kill()
+ self.wait()
while True:
+ if not select([self.stderr],[],[],0.1)[0]:
+ break
b = os.read(self.stderr.fileno(), 1024)
if b:
elines.append(b)