guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 02/03: service: 'terminate-process' ignores 'kill' exceptions


From: Ludovic Courtès
Subject: [shepherd] 02/03: service: 'terminate-process' ignores 'kill' exceptions.
Date: Fri, 26 May 2023 09:22:53 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit e7848bf1653957405451d73c91420d332f300d6a
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri May 26 13:56:13 2023 +0200

    service: 'terminate-process' ignores 'kill' exceptions.
    
    This avoids a potential race condition whereby 'kill' would
    throw (because the process terminated in the meantime), and thus nobody
    would read from REPLY, leaving the monitor blocked in a 'put-message'
    call.
    
    * modules/shepherd/service.scm (terminate-process): Catch 'system-error'
    around 'kill'.
---
 modules/shepherd/service.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 340ce67..f8849d5 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -2454,7 +2454,7 @@ group; wait for @var{pid} to terminate and return its 
exit status.  If
 been sent, send it @code{SIGKILL}."
   (let ((reply (make-channel)))
     (put-message (current-process-monitor) `(await ,(abs pid) ,reply))
-    (kill pid signal)
+    (catch-system-error (kill pid signal))
 
     (match (get-message* reply grace-period #f)
       (#f



reply via email to

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