guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 04/04: service: Ignore 'handle-termination messages while sta


From: Ludovic Courtès
Subject: [shepherd] 04/04: service: Ignore 'handle-termination messages while starting.
Date: Fri, 23 Feb 2024 17:12:49 -0500 (EST)

civodul pushed a commit to branch devel
in repository shepherd.

commit 33bcc0517c0036589aeb55633d3b8e40a7157973
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Feb 23 23:03:31 2024 +0100

    service: Ignore 'handle-termination messages while starting.
    
    A service in 'starting state has its value set to #f.  Yet, it might
    receive 'handle-termination corresponding to its previous process (e.g.,
    if it’s just been respawned).  In that case, ignore the
    'handle-termination message.
    
    Fixes a race condition whereby, while in 'starting state, the service
    would receive a 'handle-termination for its previous process, thus
    setting CONDITION to #f and eventually leading to (signal-condition! #f)
    when switching to 'running state.
    
    This bug would sometimes manifest while running ‘tests/system-star.sh’.
    
    * modules/shepherd/service.scm (service-controller): In
    'handle-termination clause, ignore notification when VALUE is not a
    process, as is the case when a process is starting.
---
 modules/shepherd/service.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 7514aec..33b8335 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -671,8 +671,8 @@ denoting what the service provides."
        ;; doesn't match VALUE (which happens with notifications of processes
        ;; terminated while stopping the service or shortly after).
        (if (or (memq status '(stopping stopped))
-               (and (process? value)
-                    (not (= (process-id value) pid))))
+               (not (process? value))
+               (not (= (process-id value) pid)))
            (loop)
            (begin
              (spawn-fiber



reply via email to

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