geo-replication: catch select.error on select()

tailer() in resource.py does not correctly catch exceptions from
select(). select() can raise an instance of the select.error class and
the current expression only catches ValueError (and the instance will
have reference called selecterror).

The geo-rep log contains a call trace like this:
> E [syncdutils:190:log_raise_exception] <top>: FAIL:
> Traceback (most recent call last):
> File "/usr/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 216, in twrap
> tf(*aa)
> File "/usr/libexec/glusterfs/python/syncdaemon/resource.py", line 123, in tailer
> poe, _ ,_ = select([po.stderr for po in errstore], [], [], 1)
> File "/usr/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 276, in select
> return eintr_wrap(oselect.select, oselect.error, *a)
> File "/usr/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 269, in eintr_wrap
> return func(*a)
> error: (9, 'Bad file descriptor')

BUG: 880308
Change-Id: I2babe42918950d0e9ddb3d08fa21aa3548ccf7c5
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/4233
Reviewed-by: Peter Portante <pportant@redhat.com>
Reviewed-by: Csaba Henk <csaba@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
This commit is contained in:
Niels de Vos 2012-11-26 17:44:36 +01:00 committed by Anand Avati
parent c6570de4d5
commit 15bf92d53c

View File

@ -12,7 +12,7 @@ import tempfile
import threading
import subprocess
from errno import EEXIST, ENOENT, ENODATA, ENOTDIR, ELOOP, EISDIR
from select import error as selecterror
from select import error as SelectError
from gconf import gconf
import repce
@ -121,7 +121,7 @@ class Popen(subprocess.Popen):
errstore = cls.errstore.copy()
try:
poe, _ ,_ = select([po.stderr for po in errstore], [], [], 1)
except ValueError, selecterror:
except (ValueError, SelectError):
continue
for po in errstore:
if po.stderr not in poe: