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
This commit is contained in:
Thomas Veerman 2013-02-22 13:57:00 +00:00
parent 4de18d528b
commit e176fa00ef

View file

@ -1002,10 +1002,21 @@ void terminate_service(struct rproc *rp)
/* Deal with failures during initialization. */ /* Deal with failures during initialization. */
if(rp->r_flags & RS_INITIALIZING) { if(rp->r_flags & RS_INITIALIZING) {
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) if(rs_verbose)
printf("RS: service '%s' exited during initialization\n", printf("RS: service '%s' exited during initialization; "
rpub->label); "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. */ rp->r_flags |= RS_EXITING; /* don't restart. */
}
/* If updating, rollback. */ /* If updating, rollback. */
if(rp->r_flags & RS_UPDATING) { if(rp->r_flags & RS_UPDATING) {