GNU bug report logs - #69269
[PATCH] gnu: web: fcgiwrap: remove UNIX socket when service stopped.

Previous Next

Package: guix-patches;

Reported by: guix-devel-0brg6b <at> rdmp.org

Date: Mon, 19 Feb 2024 11:17:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69269 in the body.
You can then email your comments to 69269 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Mon, 19 Feb 2024 11:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to guix-devel-0brg6b <at> rdmp.org:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 19 Feb 2024 11:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>
To: guix-patches <guix-patches <at> gnu.org>
Subject: [PATCH] gnu: web: fcgiwrap: remove UNIX socket when service stopped.
Date: Mon, 19 Feb 2024 10:53:24 +0000
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


Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Sat, 09 Mar 2024 09:24:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>
To: 69269 <at> debbugs.gnu.org
Cc: Dale Mellor <blackhole <at> rdmp.org>, guix-patches <at> gnu.org
Subject: [PATCH v2] gnu: web: fcgiwrap: remove UNIX socket when service
 stopped.
Date: Sat,  9 Mar 2024 09:23:11 +0000
From: Dale Mellor <blackhole <at> rdmp.org>

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-shephard-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





Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Sat, 09 Mar 2024 09:25:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Sun, 10 Mar 2024 02:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 69269 <at> debbugs.gnu.org (full text, mbox):

From: iyzsong <at> envs.net
To: guix-patches <at> gnu.org
Cc: 宋文武 <iyzsong <at> member.fsf.org>,
 69269 <at> debbugs.gnu.org
Subject: [PATCH] gnu: fcgiwrap: Update to 1.1.0-1.2870d27, switch to a fork.
Date: Sun, 10 Mar 2024 10:53:06 +0800
From: 宋文武 <iyzsong <at> member.fsf.org>

* gnu/packages/web.scm (fcgiwrap): Update to 1.1.0-1.2870d27.
[source]: Switch to https://github.com/flu0r1ne/fcgiwrap.

Change-Id: Ia9e7b911a0c8bde50924e3398f915f945cf955a6
---
 gnu/packages/web.scm | 68 +++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index ddc673896b..f163802a60 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -1109,40 +1109,44 @@ (define-public fcgi
     (license (license:non-copyleft "file://LICENSE.TERMS"))))
 
 (define-public fcgiwrap
-  (package
-    (name "fcgiwrap")
-    (version "1.1.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/gnosek/fcgiwrap")
-             (commit version)))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "1ryw66h9aazi83amk8l7ha8k5g0c7qvk5g6jv376a1ws9xk2qw6f"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:tests? #f                      ; no tests included
-       #:make-flags (list "CC=gcc")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-CFLAGS
-           ;; Remove broken options unconditionally added to CFLAGS.
-           (lambda _
-             (substitute* "configure.ac"
-               ((" -Werror") ""))
-             #t)))))
-    (native-inputs
-     (list autoconf automake pkg-config))
-    (inputs
-     (list fcgi))
-    (home-page "https://nginx.localdomain.pl/wiki/FcgiWrap")
-    (synopsis "Simple server for running CGI applications over FastCGI")
-    (description "Fcgiwrap is a simple server for running CGI applications
+  (let ((commit "2870d2729a3930988f0041e2d78fec672e69afac")
+        (revision "1"))
+    (package
+      (name "fcgiwrap")
+      (version (git-version "1.1.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               ;; Upstream last updated in 2015, this forked version has better
+               ;; socket cleanup.
+               (url "https://github.com/flu0r1ne/fcgiwrap")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0rkpp4apfhdcrmym3pcpqlncd0r4fyr3pa45i8g6x4p38b4azmmm"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f                    ; no tests included
+         #:make-flags (list "CC=gcc")
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-CFLAGS
+             ;; Remove broken options unconditionally added to CFLAGS.
+             (lambda _
+               (substitute* "configure.ac"
+                 ((" -Werror") ""))
+               #t)))))
+      (native-inputs
+       (list autoconf automake pkg-config))
+      (inputs
+       (list fcgi))
+      (home-page "https://nginx.localdomain.pl/wiki/FcgiWrap")
+      (synopsis "Simple server for running CGI applications over FastCGI")
+      (description "Fcgiwrap is a simple server for running CGI applications
 over FastCGI.  It hopes to provide clean CGI support to Nginx (and other web
 servers that may need it).")
-    (license license:expat)))
+      (license license:expat))))
 
 (define-public starman
   (package

base-commit: 1f89e15207694af210b23672a6e1b1c217c6af33
prerequisite-patch-id: 1a973b6e06113300e994be032f92bc658866e0fd
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Sun, 10 Mar 2024 02:58:02 GMT) Full text and rfc822 format available.

Message #17 received at 69269 <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>
Cc: 69269 <at> debbugs.gnu.org, blackhole <at> rdmp.org
Subject: Re: [bug#69269] [PATCH v2] gnu: web: fcgiwrap: remove UNIX socket
 when service stopped.
Date: Sun, 10 Mar 2024 10:56:45 +0800
Dale Mellor <guix-devel-0brg6b <at> rdmp.org> writes:

> From: Dale Mellor <blackhole <at> rdmp.org>
>
> 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.

Hello, I have sent a patch to update fcgiwrap to a more maintained fork,
which have the needed socket clean logic itself.

Please give it a test, I think it's better than handling that in
shepherd.  Thanks!




Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Tue, 12 Mar 2024 13:50:01 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>
To: 69269 <at> debbugs.gnu.org
Cc: 宋文武 <iyzsong <at> member.fsf.org>,
 Dale Mellor <guix-devel-0brg6b <at> rdmp.org>, guix-patches <at> gnu.org
Subject: [PATCH v3] gnu: fcgiwrap: Update to 1.1.0-1.2870d27, switch to a fork.
Date: Tue, 12 Mar 2024 13:48:28 +0000
From: 宋文武 <iyzsong <at> member.fsf.org>

* gnu/packages/web.scm (fcgiwrap): Update to 1.1.0-1.2870d27.
[source]: Switch to https://github.com/flu0r1ne/fcgiwrap.

Dale Mellor:
   - This looks good to me

   - Checked the change in the delta and the forked repository, both are
     simple and clean

   - The functionality works as advertised, and fixes the original problem
     that 'herd restart fcgiwrap' now works properly

Reviewed-by: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>

Change-Id: Ia9e7b911a0c8bde50924e3398f915f945cf955a6
---
 gnu/packages/web.scm | 68 +++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 32 deletions(-)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index ddc673896b..f163802a60 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -1109,40 +1109,44 @@ (define-public fcgi
     (license (license:non-copyleft "file://LICENSE.TERMS"))))
 
 (define-public fcgiwrap
-  (package
-    (name "fcgiwrap")
-    (version "1.1.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/gnosek/fcgiwrap")
-             (commit version)))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "1ryw66h9aazi83amk8l7ha8k5g0c7qvk5g6jv376a1ws9xk2qw6f"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:tests? #f                      ; no tests included
-       #:make-flags (list "CC=gcc")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-CFLAGS
-           ;; Remove broken options unconditionally added to CFLAGS.
-           (lambda _
-             (substitute* "configure.ac"
-               ((" -Werror") ""))
-             #t)))))
-    (native-inputs
-     (list autoconf automake pkg-config))
-    (inputs
-     (list fcgi))
-    (home-page "https://nginx.localdomain.pl/wiki/FcgiWrap")
-    (synopsis "Simple server for running CGI applications over FastCGI")
-    (description "Fcgiwrap is a simple server for running CGI applications
+  (let ((commit "2870d2729a3930988f0041e2d78fec672e69afac")
+        (revision "1"))
+    (package
+      (name "fcgiwrap")
+      (version (git-version "1.1.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               ;; Upstream last updated in 2015, this forked version has better
+               ;; socket cleanup.
+               (url "https://github.com/flu0r1ne/fcgiwrap")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0rkpp4apfhdcrmym3pcpqlncd0r4fyr3pa45i8g6x4p38b4azmmm"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f                    ; no tests included
+         #:make-flags (list "CC=gcc")
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'fix-CFLAGS
+             ;; Remove broken options unconditionally added to CFLAGS.
+             (lambda _
+               (substitute* "configure.ac"
+                 ((" -Werror") ""))
+               #t)))))
+      (native-inputs
+       (list autoconf automake pkg-config))
+      (inputs
+       (list fcgi))
+      (home-page "https://nginx.localdomain.pl/wiki/FcgiWrap")
+      (synopsis "Simple server for running CGI applications over FastCGI")
+      (description "Fcgiwrap is a simple server for running CGI applications
 over FastCGI.  It hopes to provide clean CGI support to Nginx (and other web
 servers that may need it).")
-    (license license:expat)))
+      (license license:expat))))
 
 (define-public starman
   (package
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Tue, 12 Mar 2024 13:50:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#69269; Package guix-patches. (Wed, 13 Mar 2024 13:07:02 GMT) Full text and rfc822 format available.

Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>
Cc: iyzsong <at> member.fsf.org, 69269-done <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#69269] [PATCH v3] gnu: fcgiwrap: Update to
 1.1.0-1.2870d27, switch to a fork.
Date: Wed, 13 Mar 2024 13:05:38 +0000
[Message part 1 (text/plain, inline)]
Dale Mellor <guix-devel-0brg6b <at> rdmp.org> writes:

> From: 宋文武 <iyzsong <at> member.fsf.org>
>
> * gnu/packages/web.scm (fcgiwrap): Update to 1.1.0-1.2870d27.
> [source]: Switch to https://github.com/flu0r1ne/fcgiwrap.
>
> Dale Mellor:
>    - This looks good to me
>
>    - Checked the change in the delta and the forked repository, both are
>      simple and clean
>
>    - The functionality works as advertised, and fixes the original problem
>      that 'herd restart fcgiwrap' now works properly
>
> Reviewed-by: Dale Mellor <guix-devel-0brg6b <at> rdmp.org>
>
> Change-Id: Ia9e7b911a0c8bde50924e3398f915f945cf955a6
> ---
>  gnu/packages/web.scm | 68 +++++++++++++++++++++++---------------------
>  1 file changed, 36 insertions(+), 32 deletions(-)

Thanks both, I've pushed this to master as
7b5c030684020282a690322b558f86718eb148a7.

Chris
[signature.asc (application/pgp-signature, inline)]

Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Wed, 13 Mar 2024 13:07:02 GMT) Full text and rfc822 format available.

Notification sent to guix-devel-0brg6b <at> rdmp.org:
bug acknowledged by developer. (Wed, 13 Mar 2024 13:07:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Apr 2024 11:24:34 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 128 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.