[systemd-devel] [PATCH] systemd: Fail a service if it exceeds its start limit

Lennart Poettering lennart at poettering.net
Wed Aug 8 09:54:43 PDT 2012


On Mon, 06.08.12 15:30, Eelco Dolstra (eelco.dolstra at logicblox.com) wrote:

> Previously, if a service configured to restart automatically exceeds
> its start limit, it entered the "inactive/dead" state.  That seems
> wrong to me, since there is nothing to indicate to the user that the
> service has failed.  This patch causes it to enter the failed state
> instead.

This definitely makes a lot of sense, but probably should look a bit
differently. i.e. I figure we should go through service_enter_dead()
instead, and we should introduce a new ServiceResult value for this
(SERVICE_FAILURE_START_LIMIT or so?), so that people can distinguish
this error condition from others?

> ---
>  src/core/service.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/core/service.c b/src/core/service.c
> index 1c127bd..eafdbe5 100644
> --- a/src/core/service.c
> +++ b/src/core/service.c
> @@ -2487,6 +2487,7 @@ static int service_start(Unit *u) {
>          r = service_start_limit_test(s);
>          if (r < 0) {
>                  service_notify_sockets_dead(s, true);
> +                service_set_state(s, SERVICE_FAILED);
>                  return r;
>          }
>  


Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list