From patchwork Mon Feb 19 10:53:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dale Mellor X-Patchwork-Id: 60777 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 33B4C27BBE9; Mon, 19 Feb 2024 11:17:00 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D555927BBE2 for ; Mon, 19 Feb 2024 11:16:53 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rc1db-0001Ht-Gh; Mon, 19 Feb 2024 06:16:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1dZ-0001HY-QF for guix-patches@gnu.org; Mon, 19 Feb 2024 06:16:42 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rc1dZ-0006Cu-Hl for guix-patches@gnu.org; Mon, 19 Feb 2024 06:16:41 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rc1du-0004gx-6u for guix-patches@gnu.org; Mon, 19 Feb 2024 06:17:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69269] [PATCH] gnu: web: fcgiwrap: remove UNIX socket when service stopped. Resent-From: Dale Mellor Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 19 Feb 2024 11:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69269 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69269@debbugs.gnu.org X-Debbugs-Original-To: guix-patches Received: via spool by submit@debbugs.gnu.org id=B.170834139717972 (code B ref -1); Mon, 19 Feb 2024 11:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Feb 2024 11:16:37 +0000 Received: from localhost ([127.0.0.1]:40472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc1dU-0004fo-Uo for submit@debbugs.gnu.org; Mon, 19 Feb 2024 06:16:37 -0500 Received: from lists.gnu.org ([209.51.188.17]:34196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rc1dQ-0004fc-Fj for submit@debbugs.gnu.org; Mon, 19 Feb 2024 06:16:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1d3-0001E7-M2 for guix-patches@gnu.org; Mon, 19 Feb 2024 06:16:09 -0500 Received: from [195.15.247.228] (helo=rdmp.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rc1d1-000653-IJ for guix-patches@gnu.org; Mon, 19 Feb 2024 06:16:09 -0500 Received: from [127.0.0.1] (helo=[IPv6:::1]) by rdmp.org with esmtp (Exim 4.96.1) (envelope-from ) id 1rc1Fv-0002xz-2X for guix-patches@gnu.org; Mon, 19 Feb 2024 10:53:24 +0000 Message-ID: From: Dale Mellor Date: Mon, 19 Feb 2024 10:53:24 +0000 Organization: DM Bespoke Computer Solutions Ltd User-Agent: Evolution 3.46.4 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.15.247.228 (failed) Received-SPF: softfail client-ip=195.15.247.228; envelope-from=guix-devel-0brg6b@rdmp.org; helo=rdmp.org X-Spam_score_int: 3 X-Spam_score: 0.3 X-Spam_bar: / X-Spam_report: (0.3 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_SOFTFAIL=0.732, SPF_SOFTFAIL=0.665, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: guix-devel-0brg6b@rdmp.org Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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