From 80f4d9a0561f7b263c2d9f0e1cc941208b58a468 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 4 Apr 2012 03:12:26 +0200 Subject: geo-rep / gsyncd: recognize ECONNABORTED as termination of aux glusterfs Don't dump stack, rather log the "glusterfs session went down" message. If the aux glusterfs is already dead when we try to do some file operation, we get a failure with ENOTCONN, which is already handled as above. However, it's also possible that glusterfs dies while we are in a syscall into it -- in that case we get ECONNABORTED, and so far then we end up with an ugly stack strace. From now on we take ECONNABORTAD as well into consideration. Nb. wrt. testing: it's not easy to synthetically force the aux glusterfs to end this way; for that we have to provoke gsyncd into intensive synchronization. I succeeded in that with the following ruby oneliner: ruby -rcgi -e ' Dir.chdir($*[0]) a=[] Thread.new { loop { while a.size >= 100; File.delete a.shift; end; sleep 1 }} loop { a< Reviewed-on: http://review.gluster.com/3078 Tested-by: Gluster Build System Reviewed-by: Venky Shankar Reviewed-by: Vijay Bellur Reviewed-on: http://review.gluster.com/3408 --- xlators/features/marker/utils/syncdaemon/syncdutils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/marker/utils/syncdaemon/syncdutils.py b/xlators/features/marker/utils/syncdaemon/syncdutils.py index c0f0ddd481a..b29936d596d 100644 --- a/xlators/features/marker/utils/syncdaemon/syncdutils.py +++ b/xlators/features/marker/utils/syncdaemon/syncdutils.py @@ -6,7 +6,7 @@ import fcntl import shutil import logging from threading import Lock, Thread as baseThread -from errno import EACCES, EAGAIN, EPIPE, ENOTCONN, EINTR +from errno import EACCES, EAGAIN, EPIPE, ENOTCONN, ECONNABORTED, EINTR, errorcode from signal import SIGTERM, SIGKILL from time import sleep import select as oselect @@ -174,8 +174,8 @@ def log_raise_exception(excont): if hasattr(gconf, 'transport'): gconf.transport.wait() gconf.transport.terminate_geterr() - elif isinstance(exc, OSError) and exc.errno == ENOTCONN: - logging.error('glusterfs session went down') + elif isinstance(exc, OSError) and exc.errno in (ENOTCONN, ECONNABORTED): + logging.error('glusterfs session went down [%s]', errorcode[exc.errno]) else: logtag = "FAIL" if not logtag and logging.getLogger().isEnabledFor(logging.DEBUG): -- cgit