guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 04/07: service: Removed unnecessary and racy 'handle-terminat


From: Ludovic Courtès
Subject: [shepherd] 04/07: service: Removed unnecessary and racy 'handle-termination' messages.
Date: Fri, 24 Mar 2023 13:31:41 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit e85c160d37e00fa97b4384f16b108506fc13670a
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Mar 24 14:27:20 2023 +0100

    service: Removed unnecessary and racy 'handle-termination' messages.
    
    * modules/shepherd/service.scm (service-controller): Do not send
    'notify-termination' message after calling the 'handle-termination'
    slot: the 'notify-termination' message could be received *before*
    'handle-termination' has run and sent a 'handle-termination' message,
    in which case we'd fail to respawn the service.
    (stop): Do not send 'notify-termination' message: it is redundant with
    the 'stopped-message?' sent once the 'stop' procedure has completed.
---
 modules/shepherd/service.scm | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index cd9bcdd..8d4ccc0 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -461,8 +461,7 @@ Log abnormal termination reported by @var{status}."
               (lambda ()
                 (false-if-exception
                  ((slot-ref service 'handle-termination)
-                  service value exit-status))
-                (put-message channel 'notify-termination)))
+                  service value exit-status))))
              (loop (status 'stopped) (value #f) (condition #f)))))
 
       ('record-respawn-time                       ;no reply
@@ -805,10 +804,6 @@ is not already running, and will return SERVICE's 
canonical name in a list."
                  (put-message notification #f)
                  (caught-error key args))))))
 
-        ;; SERVICE is no longer running.
-        (put-message (service-control service)
-                     'notify-termination)
-
         ;; Status message.
         (if (running? service)
             (local-output (l10n "Service ~a could not be stopped.")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]