[SSSD] [PATCH] Restart services with a delay in case they are restarted too often

Pavel Březina pbrezina at redhat.com
Fri Nov 16 10:41:50 UTC 2012


On 11/15/2012 07:51 PM, Jakub Hrozek wrote:
> In case a service is restarted while the DP is not ready yet, it gets
> restarted again immediatelly, which means the DP might still not be
> ready. The allowed number of restarts is then depleted quickly.
>
> This patch changes the restart mechanism such that the first restart
> happens immediatelly, the second is scheduled after 2 second, then 4
> etc..
>
> https://fedorahosted.org/sssd/ticket/1528

Hi,

> +    /* restarts are schedule after 0, 2, 4, ...seconds */
> +    tv = tevent_timeval_current_ofs((svc->restarts << 1), 0);
> +    te = tevent_add_timer(svc->mt_ctx->ev, svc, tv, mt_svc_restart, svc);

I would consider setting 4 seconds as a maximum delay instead of
going to infinity. Any opinions?

> +static void mt_svc_restart(struct tevent_context *ev,
> +                           struct tevent_timer *te,
> +                           struct timeval t, void *ptr)
> +{
> +    struct mt_svc *svc;
> +
> +    svc = talloc_get_type(ptr, struct mt_svc);
> +    if (svc == NULL) {
> +        return;
> +    }
> +
> +    DEBUG(SSSDBG_TRACE_FUNC,
> +          ("Scheduling a service for restart %d\n", svc->restarts));

It should say svc->restarts + 1. Can you also add a service name to the
message?




More information about the sssd-devel mailing list