all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dale Mellor <guix-devel-0brg6b@rdmp.org>
To: 69269@debbugs.gnu.org
Subject: [bug#69269] [PATCH] gnu: web: fcgiwrap: remove UNIX socket when service stopped.
Date: Mon, 19 Feb 2024 10:53:24 +0000	[thread overview]
Message-ID: <e772ea18391c7ea335bc8faf10669a56ab27c9ba.camel@rdmp.org> (raw)

The generic kill destructor is used to terminate the process, but if it was
configured to use a UNIX socket, that socket gets left behind.  Subsequent
attempts to re-start the service then fail with a 'socket in use' error.  So
we perform extra duty in the stop action to clean up if necessary.

* gnu/services/web.scm: new logic in fcgiwrap-shepherd-service.
---
 gnu/services/web.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 05fd71f9949..877e15342b0 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -907,7 +907,14 @@ (define fcgiwrap-shepherd-service
                         "-s" #$socket)
                       #:user #$user #:group #$group
                       #:log-file "/var/log/fcgiwrap.log"))
-            (stop #~(make-kill-destructor)))))))
+            (stop #~(let ((mkd (make-kill-destructor)))
+                      (lambda x
+                        (apply mkd x)
+                        (when (string-prefix? "unix:" #$socket)
+                          (let ((socket (substring #$socket 5)))
+                            (when (access? socket F_OK)
+                              (delete-file socket))))
+                        #f))))))))
 
 (define fcgiwrap-activation
   (match-lambda
-- 
2.41.0


             reply	other threads:[~2024-02-19 11:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 10:53 Dale Mellor [this message]
2024-03-09  9:23 ` [bug#69269] [PATCH v2] gnu: web: fcgiwrap: remove UNIX socket when service stopped Dale Mellor
2024-03-10  2:56   ` 宋文武 via Guix-patches via
2024-03-12 13:48 ` [bug#69269] [PATCH v3] gnu: fcgiwrap: Update to 1.1.0-1.2870d27, switch to a fork Dale Mellor
2024-03-13 13:05   ` Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e772ea18391c7ea335bc8faf10669a56ab27c9ba.camel@rdmp.org \
    --to=guix-devel-0brg6b@rdmp.org \
    --cc=69269@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.