GNU bug report logs - #68357
[PATCH] service: fix `unload all` * modules/shepherd/service.scm: fix `unload all`

Previous Next

Package: guix-patches;

Reported by: "zero <at> fedora" <shinyzero0 <at> tilde.club>

Date: Wed, 10 Jan 2024 00:32: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 68357 in the body.
You can then email your comments to 68357 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#68357; Package guix-patches. (Wed, 10 Jan 2024 00:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "zero <at> fedora" <shinyzero0 <at> tilde.club>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 10 Jan 2024 00:32:02 GMT) Full text and rfc822 format available.

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

From: "zero <at> fedora" <shinyzero0 <at> tilde.club>
To: guix-patches <at> gnu.org
Cc: "zero <at> fedora" <shinyzero0 <at> tilde.club>
Subject: [PATCH] service: fix `unload all` * modules/shepherd/service.scm: fix
 `unload all`
Date: Wed, 10 Jan 2024 03:29:22 +0300
---
 modules/shepherd/service.scm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5be78bd..54d3400 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1136,11 +1136,6 @@ requests arriving on @var{channel}."
                  (length lst))
            (map service-canonical-name lst))
           (loop registered))))
-      (('unregister-all)                          ;no reply
-       (let ((root (cdr (vhash-assq 'root registered))))
-         (loop (fold (cut vhash-consq <> root <>)
-                     vlist-null
-                     (service-provision root)))))
       (('lookup name reply)
        ;; Look up NAME and return it, or #f, to REPLY.
        (put-message reply
@@ -2638,8 +2633,11 @@ requested to be removed."
   (let ((name (string->symbol service-name)))
     (cond ((eq? name 'all)
            ;; Special 'remove all' case.
-           (put-message (current-registry-channel) `(unregister-all))
-           #t)
+           (unregister-services
+             (filter
+               (lambda (sv)
+                 (not (eq? (service-canonical-name sv) 'root)))
+               (service-list))))
           (else
            ;; Removing only one service.
            (match (lookup-service name)
-- 
2.43.0





Information forwarded to guix-patches <at> gnu.org:
bug#68357; Package guix-patches. (Wed, 10 Jan 2024 00:35:02 GMT) Full text and rfc822 format available.

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

From: "zero <at> fedora" <shinyzero0 <at> tilde.club>
To: 68357 <at> debbugs.gnu.org
Cc: "zero <at> fedora" <shinyzero0 <at> tilde.club>
Subject: [PATCH] shepherd: service: fix `unload all`
Date: Wed, 10 Jan 2024 03:33:15 +0300
---
 modules/shepherd/service.scm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5be78bd..54d3400 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1136,11 +1136,6 @@ requests arriving on @var{channel}."
                  (length lst))
            (map service-canonical-name lst))
           (loop registered))))
-      (('unregister-all)                          ;no reply
-       (let ((root (cdr (vhash-assq 'root registered))))
-         (loop (fold (cut vhash-consq <> root <>)
-                     vlist-null
-                     (service-provision root)))))
       (('lookup name reply)
        ;; Look up NAME and return it, or #f, to REPLY.
        (put-message reply
@@ -2638,8 +2633,11 @@ requested to be removed."
   (let ((name (string->symbol service-name)))
     (cond ((eq? name 'all)
            ;; Special 'remove all' case.
-           (put-message (current-registry-channel) `(unregister-all))
-           #t)
+           (unregister-services
+             (filter
+               (lambda (sv)
+                 (not (eq? (service-canonical-name sv) 'root)))
+               (service-list))))
           (else
            ;; Removing only one service.
            (match (lookup-service name)
-- 
2.43.0





Information forwarded to guix-patches <at> gnu.org:
bug#68357; Package guix-patches. (Wed, 10 Jan 2024 01:33:02 GMT) Full text and rfc822 format available.

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

From: "zero <at> fedora" <shinyzero0 <at> tilde.club>
To: 68357 <at> debbugs.gnu.org
Cc: "zero <at> fedora" <shinyzero0 <at> tilde.club>
Subject: [PATCH] shepherd: service: fix `unload all`
Date: Wed, 10 Jan 2024 04:30:59 +0300
* modules/shepherd/service.scm: fix `unload all`

---
 modules/shepherd/service.scm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 5be78bd..54d3400 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -1136,11 +1136,6 @@ requests arriving on @var{channel}."
                  (length lst))
            (map service-canonical-name lst))
           (loop registered))))
-      (('unregister-all)                          ;no reply
-       (let ((root (cdr (vhash-assq 'root registered))))
-         (loop (fold (cut vhash-consq <> root <>)
-                     vlist-null
-                     (service-provision root)))))
       (('lookup name reply)
        ;; Look up NAME and return it, or #f, to REPLY.
        (put-message reply
@@ -2638,8 +2633,11 @@ requested to be removed."
   (let ((name (string->symbol service-name)))
     (cond ((eq? name 'all)
            ;; Special 'remove all' case.
-           (put-message (current-registry-channel) `(unregister-all))
-           #t)
+           (unregister-services
+             (filter
+               (lambda (sv)
+                 (not (eq? (service-canonical-name sv) 'root)))
+               (service-list))))
           (else
            ;; Removing only one service.
            (match (lookup-service name)
-- 
2.43.0





Information forwarded to guix-patches <at> gnu.org:
bug#68357; Package guix-patches. (Sun, 14 Jan 2024 21:34:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: "zero <at> fedora" <shinyzero0 <at> tilde.club>
Cc: 68357 <at> debbugs.gnu.org
Subject: Re: [bug#68357] [PATCH] shepherd: service: fix `unload all`
Date: Sun, 14 Jan 2024 22:33:18 +0100
Hi,

"zero <at> fedora" <shinyzero0 <at> tilde.club> skribis:

> * modules/shepherd/service.scm: fix `unload all`

Thanks for the patch!

> -      (('unregister-all)                          ;no reply
> -       (let ((root (cdr (vhash-assq 'root registered))))
> -         (loop (fold (cut vhash-consq <> root <>)
> -                     vlist-null
> -                     (service-provision root)))))
>        (('lookup name reply)
>         ;; Look up NAME and return it, or #f, to REPLY.
>         (put-message reply
> @@ -2638,8 +2633,11 @@ requested to be removed."
>    (let ((name (string->symbol service-name)))
>      (cond ((eq? name 'all)
>             ;; Special 'remove all' case.
> -           (put-message (current-registry-channel) `(unregister-all))
> -           #t)
> +           (unregister-services
> +             (filter
> +               (lambda (sv)
> +                 (not (eq? (service-canonical-name sv) 'root)))
> +               (service-list))))

Do I get it right that the problem with the current implementation is
that services are removed from the registry but not actually stopped?

Ludo’.





Information forwarded to guix-patches <at> gnu.org:
bug#68357; Package guix-patches. (Sun, 14 Jan 2024 22:54:02 GMT) Full text and rfc822 format available.

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

From: "ShinyZero0" <shinyzero0 <at> tilde.club>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 68357 <at> debbugs.gnu.org
Subject: Re: [bug#68357] [PATCH] shepherd: service: fix `unload all`
Date: Mon, 15 Jan 2024 01:53:25 +0300
Hi Ludo! Thanks for replying.

Yes, that was the problem. `herd reload root all` was leaving the
processes running and many of them crashed or had strange behaviour
after loading, so one had to kill them manually and then restart 
the services.

Of course `herd unload root all` was the same.

Best wishes, Paul.




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

Notification sent to "zero <at> fedora" <shinyzero0 <at> tilde.club>:
bug acknowledged by developer. (Sun, 21 Jan 2024 22:24:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: "ShinyZero0" <shinyzero0 <at> tilde.club>
Cc: 68357-done <at> debbugs.gnu.org
Subject: Re: [bug#68357] [PATCH] shepherd: service: fix `unload all`
Date: Sun, 21 Jan 2024 23:23:03 +0100
Hi!

"ShinyZero0" <shinyzero0 <at> tilde.club> skribis:

> Yes, that was the problem. `herd reload root all` was leaving the
> processes running and many of them crashed or had strange behaviour
> after loading, so one had to kill them manually and then restart 
> the services.
>
> Of course `herd unload root all` was the same.
>
> Best wishes, Paul.

Thanks for clarifying.  I pushed something similar along with a test as
commit b7fcdad75dff73fb4a8f531d0834eb9a965bcfd6.

Ludo’.




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

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

Previous Next


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