GNU bug report logs - #68468
[PATCH] gnu: services: Add respawn-limit and respawn-delay.

Previous Next

Package: guix-patches;

Reported by: Attila Lendvai <attila.lendvai <at> gmail.com>

Date: Mon, 15 Jan 2024 10:45:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 68468 in the body.
You can then email your comments to 68468 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#68468; Package guix-patches. (Mon, 15 Jan 2024 10:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Attila Lendvai <attila.lendvai <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 15 Jan 2024 10:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Attila Lendvai <attila.lendvai <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Attila Lendvai <attila <at> lendvai.name>
Subject: [PATCH] gnu: services: Add respawn-limit and respawn-delay.
Date: Mon, 15 Jan 2024 11:43:47 +0100
* gnu/services/shepherd.scm (<shepherd-service>): Add respawn-limit and
respawn-delay.

Change-Id: I54408e8fb4bcc0956d9610771bf5c566fdc2914c
---
 gnu/services/shepherd.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 5ebac129cec..f5bcde721fe 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -55,6 +55,8 @@ (define-module (gnu services shepherd)
             shepherd-service-canonical-name
             shepherd-service-requirement
             shepherd-service-one-shot?
+            shepherd-service-respawn-limit
+            shepherd-service-respawn-delay
             shepherd-service-respawn?
             shepherd-service-start
             shepherd-service-stop
@@ -211,6 +213,10 @@ (define-record-type* <shepherd-service>
                  (default #f))
   (respawn?      shepherd-service-respawn?             ;Boolean
                  (default #t))
+  (respawn-limit shepherd-service-respawn-limit
+                 (default #f))
+  (respawn-delay shepherd-service-respawn-delay
+                 (default #f))
   (start         shepherd-service-start)               ;g-expression (procedure)
   (stop          shepherd-service-stop                 ;g-expression (procedure)
                  (default #~(const #f)))
@@ -309,6 +315,14 @@ (define (shepherd-service-file service)
                        #:one-shot? '#$(shepherd-service-one-shot? service)
 
                        #:respawn? '#$(shepherd-service-respawn? service)
+                       #$@(if (shepherd-service-respawn-limit service)
+                              `(#:respawn-limit
+                                ,(shepherd-service-respawn-limit service))
+                              '())
+                       #$@(if (shepherd-service-respawn-delay service)
+                              `(#:respawn-delay
+                                ,(shepherd-service-respawn-delay service))
+                              '())
                        #:start #$(shepherd-service-start service)
                        #:stop #$(shepherd-service-stop service)
                        #:actions

base-commit: 162d6a2fdd6af13272967c77347a54934ecb45e6
prerequisite-patch-id: 2adcd37ab1f0752ec27a4edabbabe1c65d88f122
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#68468; Package guix-patches. (Wed, 24 Jan 2024 22:16:01 GMT) Full text and rfc822 format available.

Message #8 received at 68468 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Attila Lendvai <attila.lendvai <at> gmail.com>
Cc: Attila Lendvai <attila <at> lendvai.name>, 68468 <at> debbugs.gnu.org
Subject: Re: [bug#68468] [PATCH] gnu: services: Add respawn-limit and
 respawn-delay.
Date: Wed, 24 Jan 2024 23:15:23 +0100
Hi,

Attila Lendvai <attila.lendvai <at> gmail.com> skribis:

> * gnu/services/shepherd.scm (<shepherd-service>): Add respawn-limit and
> respawn-delay.
>
> Change-Id: I54408e8fb4bcc0956d9610771bf5c566fdc2914c

Neat!  Please also mention the changes in ‘shepherd-service-file’.

> +  (respawn-limit shepherd-service-respawn-limit
> +                 (default #f))
> +  (respawn-delay shepherd-service-respawn-delay
> +                 (default #f))

Could you document them in ‘doc/guix.texi’?

> +                       #$@(if (shepherd-service-respawn-limit service)
> +                              `(#:respawn-limit
> +                                ,(shepherd-service-respawn-limit service))
> +                              '())
> +                       #$@(if (shepherd-service-respawn-delay service)
> +                              `(#:respawn-delay
> +                                ,(shepherd-service-respawn-delay service))
> +                              '())

In theory, we could end up loading code that uses #:respawn-limit in a
running shepherd that does not support it (too old).  To properly
address that, we’d need to check what shepherd version we’re talking to.

But… I think we can ignore this issue, as long as we don’t use it in
gnu/services/*.scm until some time has passed.

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#68468; Package guix-patches. (Thu, 25 Jan 2024 15:07:02 GMT) Full text and rfc822 format available.

Message #11 received at 68468 <at> debbugs.gnu.org (full text, mbox):

From: attila.lendvai <at> gmail.com
To: 68468 <at> debbugs.gnu.org
Cc: Attila Lendvai <attila <at> lendvai.name>
Subject: [PATCH v2] gnu: services: Add respawn-limit and respawn-delay.
Date: Thu, 25 Jan 2024 16:05:41 +0100
From: Attila Lendvai <attila <at> lendvai.name>

* gnu/services/shepherd.scm (<shepherd-service>): Add respawn-limit and
respawn-delay.
(shepherd-service-file): Emit the two values into the shepherd service
constructor form.

Change-Id: I54408e8fb4bcc0956d9610771bf5c566fdc2914c
---
 doc/guix.texi             |  8 ++++++++
 gnu/services/shepherd.scm | 14 ++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index a66005ee9db..9f911643352 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42888,6 +42888,14 @@ Shepherd Services
 Whether to restart the service when it stops, for instance when the
 underlying process dies.
 
+@item @code{respawn-limit} (default: @code{#f})
+Set a limit on how many times and how frequently a service may be
+restarted by Shepherd before it is disabled.  See @pxref{Defining
+Services,,, shepherd, The GNU Shepherd Manual} for details.
+
+@item @code{respawn-delay} (default: @code{#f})
+Wait @code{respawn-delay} seconds before restarting a failed service.
+
 @item @code{start}
 @itemx @code{stop} (default: @code{#~(const #f)})
 The @code{start} and @code{stop} fields refer to the Shepherd's
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index 5ebac129cec..f5bcde721fe 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -55,6 +55,8 @@ (define-module (gnu services shepherd)
             shepherd-service-canonical-name
             shepherd-service-requirement
             shepherd-service-one-shot?
+            shepherd-service-respawn-limit
+            shepherd-service-respawn-delay
             shepherd-service-respawn?
             shepherd-service-start
             shepherd-service-stop
@@ -211,6 +213,10 @@ (define-record-type* <shepherd-service>
                  (default #f))
   (respawn?      shepherd-service-respawn?             ;Boolean
                  (default #t))
+  (respawn-limit shepherd-service-respawn-limit
+                 (default #f))
+  (respawn-delay shepherd-service-respawn-delay
+                 (default #f))
   (start         shepherd-service-start)               ;g-expression (procedure)
   (stop          shepherd-service-stop                 ;g-expression (procedure)
                  (default #~(const #f)))
@@ -309,6 +315,14 @@ (define (shepherd-service-file service)
                        #:one-shot? '#$(shepherd-service-one-shot? service)
 
                        #:respawn? '#$(shepherd-service-respawn? service)
+                       #$@(if (shepherd-service-respawn-limit service)
+                              `(#:respawn-limit
+                                ,(shepherd-service-respawn-limit service))
+                              '())
+                       #$@(if (shepherd-service-respawn-delay service)
+                              `(#:respawn-delay
+                                ,(shepherd-service-respawn-delay service))
+                              '())
                        #:start #$(shepherd-service-start service)
                        #:stop #$(shepherd-service-stop service)
                        #:actions

base-commit: 162d6a2fdd6af13272967c77347a54934ecb45e6
prerequisite-patch-id: 2adcd37ab1f0752ec27a4edabbabe1c65d88f122
-- 
2.41.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 28 Jan 2024 21:29:02 GMT) Full text and rfc822 format available.

Notification sent to Attila Lendvai <attila.lendvai <at> gmail.com>:
bug acknowledged by developer. (Sun, 28 Jan 2024 21:29:02 GMT) Full text and rfc822 format available.

Message #16 received at 68468-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: attila.lendvai <at> gmail.com
Cc: 68468-done <at> debbugs.gnu.org, Attila Lendvai <attila <at> lendvai.name>
Subject: Re: [bug#68468] [PATCH v2] gnu: services: Add respawn-limit and
 respawn-delay.
Date: Sun, 28 Jan 2024 22:28:37 +0100
[Message part 1 (text/plain, inline)]
Hi,

attila.lendvai <at> gmail.com skribis:

> From: Attila Lendvai <attila <at> lendvai.name>
>
> * gnu/services/shepherd.scm (<shepherd-service>): Add respawn-limit and
> respawn-delay.
> (shepherd-service-file): Emit the two values into the shepherd service
> constructor form.
>
> Change-Id: I54408e8fb4bcc0956d9610771bf5c566fdc2914c

Applied with the tweaks below, thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/guix.texi b/doc/guix.texi
index 6b95ff89e0..9c703da9bc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -43145,11 +43145,12 @@ Shepherd Services
 
 @item @code{respawn-limit} (default: @code{#f})
 Set a limit on how many times and how frequently a service may be
-restarted by Shepherd before it is disabled.  See @pxref{Defining
-Services,,, shepherd, The GNU Shepherd Manual} for details.
+restarted by Shepherd before it is disabled.  @xref{Defining
+Services,,, shepherd, The GNU Shepherd Manual}, for details.
 
 @item @code{respawn-delay} (default: @code{#f})
-Wait @code{respawn-delay} seconds before restarting a failed service.
+When true, this is the delay in seconds before restarting a failed
+service.
 
 @item @code{start}
 @itemx @code{stop} (default: @code{#~(const #f)})

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 26 Feb 2024 12:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 110 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.