From e176fa00ef66477dec5e1ce0ce17238773ba3495 Mon Sep 17 00:00:00 2001 From: Thomas Veerman Date: Fri, 22 Feb 2013 13:57:00 +0000 Subject: [PATCH] RS: refresh service upon init failure When a service fails to initialize, RS exits the service. When injecting faults this is undesired behavior. With this patch, we're going to assume that when starting services with the -b flag (no binary exponential offset), we don't want to exit the service but simply restart the initialization. Change-Id: Ie8b9c89e16fe4df8a89ec30ec678a216b4ec5fd0 --- servers/rs/manager.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/servers/rs/manager.c b/servers/rs/manager.c index f05ed3d08..266023b4b 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -1002,10 +1002,21 @@ void terminate_service(struct rproc *rp) /* Deal with failures during initialization. */ if(rp->r_flags & RS_INITIALIZING) { - if(rs_verbose) - printf("RS: service '%s' exited during initialization\n", - rpub->label); - rp->r_flags |= RS_EXITING; /* don't restart. */ + if (rpub->sys_flags & SF_NO_BIN_EXP) { + /* If service was deliberately started with binary exponential offset + * disabled, we're going to assume we want to refresh a service upon + * failure. + */ + if(rs_verbose) + printf("RS: service '%s' exited during initialization; " + "refreshing\n", rpub->label); + rp->r_flags |= RS_REFRESHING; /* restart initialization. */ + } else { + if(rs_verbose) + printf("RS: service '%s' exited during initialization; " + "not restarting\n", rpub->label); + rp->r_flags |= RS_EXITING; /* don't restart. */ + } /* If updating, rollback. */ if(rp->r_flags & RS_UPDATING) {