GNU bug report logs - #32665
Shepherd is stuck waiting for /var/run/nginx/pid

Previous Next

Package: guix;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Sat, 8 Sep 2018 17:00:02 UTC

Severity: important

Done: ludo <at> gnu.org (Ludovic Courtès)

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 32665 in the body.
You can then email your comments to 32665 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 bug-guix <at> gnu.org:
bug#32665; Package guix. (Sat, 08 Sep 2018 17:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ludo <at> gnu.org (Ludovic Courtès):
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 08 Sep 2018 17:00:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-guix <at> gnu.org
Cc: Ricardo Wurmus <rekado <at> elephly.net>, clement <at> lassieur.org
Subject: Shepherd is stuck waiting for /var/run/nginx/pid
Date: Sat, 08 Sep 2018 18:53:13 +0200
[Message part 1 (text/plain, inline)]
Hello Clément,

Commit 9fc2922794ffaae48e0a7c536e530ea2e0d46cf3 adds a loop to the nginx
service that checks for /var/run/nginx/pid.  Unfortunately, on berlin
that loop never ends because the file is not created (on berlin we use a
“hand-written” nginx config file that lacks a “pid” directive; see
guix-maintenance.git.)

I think there are two things to address:

  1. Don’t look for a PID file when passed a hand-written config file;

  2. Make sure the loop always terminates, similar to what
    ‘make-forkexec-constructor’ does.

The patch below fixes that.  The second patch fixes the ‘stop’
procedure.

Thoughts?

Ludo’.

[0001-services-nginx-Don-t-read-PID-file-when-passed-a-cus.patch (text/x-patch, inline)]
From c9daf228a69c24cff6ba5508a3b67ebe3c702a2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo <at> gnu.org>
Date: Sat, 8 Sep 2018 18:48:48 +0200
Subject: [PATCH 1/2] services: nginx: Don't read PID file when passed a custom
 config file.

Fixes <https://bugs.gnu.org/XXX>.

* gnu/services/web.scm (nginx-shepherd-service): Check whether FILE is
true and don't read the PID file if it is; use 'read-pid-file' instead
of a potentially endless loop.
---
 gnu/services/web.scm | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 3778efd04..1c993b29f 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -610,14 +610,12 @@ of index files."
                  (match '#$args
                    (("-s" . _) #t)
                    (_
-                    (let loop ((duration 0))
-                      ;; https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864/comments/7
-                      (sleep duration)
-                      (if (file-exists? #$pid-file)
-                          (let ((pid (call-with-input-file #$pid-file read)))
-                            ;; it could be #<eof>
-                            (if (integer? pid) pid (loop 1)))
-                          (loop 1)))))))))
+                    ;; When FILE is true, we cannot be sure that PID-FILE will
+                    ;; be created, so assume it won't show up.  When FILE is
+                    ;; false, read PID-FILE.
+                    #$(if file
+                          #~#t
+                          #~(read-pid-file #$pid-file))))))))
 
      ;; TODO: Add 'reload' action.
      (list (shepherd-service
-- 
2.18.0

[0002-services-nginx-stop-returns-f.patch (text/x-patch, inline)]
From 211a820dbd37926f07f9245ab42cbaf6fb0264bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo <at> gnu.org>
Date: Sat, 8 Sep 2018 18:50:55 +0200
Subject: [PATCH 2/2] services: nginx: 'stop' returns #f.

Previously we'd return #t, which the Shepherd would consider a failure
to stop the service.

* gnu/services/web.scm (nginx-shepherd-service): In 'nginx-action',
return #f when stopping the service.
---
 gnu/services/web.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 1c993b29f..df82a6de6 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -608,7 +608,7 @@ of index files."
                                (default-nginx-config config))
                          #$@args)
                  (match '#$args
-                   (("-s" . _) #t)
+                   (("-s" . _) #f)
                    (_
                     ;; When FILE is true, we cannot be sure that PID-FILE will
                     ;; be created, so assume it won't show up.  When FILE is
-- 
2.18.0


Information forwarded to bug-guix <at> gnu.org:
bug#32665; Package guix. (Sat, 08 Sep 2018 17:20:02 GMT) Full text and rfc822 format available.

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

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, bug-guix <at> gnu.org
Subject: Re: Shepherd is stuck waiting for /var/run/nginx/pid
Date: Sat, 08 Sep 2018 19:16:41 +0200
Oh!  Sorry for the mess.  The patches both look good to me, thank you!

Clément

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hello Clément,
>
> Commit 9fc2922794ffaae48e0a7c536e530ea2e0d46cf3 adds a loop to the nginx
> service that checks for /var/run/nginx/pid.  Unfortunately, on berlin
> that loop never ends because the file is not created (on berlin we use a
> “hand-written” nginx config file that lacks a “pid” directive; see
> guix-maintenance.git.)
>
> I think there are two things to address:
>
>   1. Don’t look for a PID file when passed a hand-written config file;
>
>   2. Make sure the loop always terminates, similar to what
>     ‘make-forkexec-constructor’ does.
>
> The patch below fixes that.  The second patch fixes the ‘stop’
> procedure.
>
> Thoughts?
>
> Ludo’.
>
> From c9daf228a69c24cff6ba5508a3b67ebe3c702a2b Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo <at> gnu.org>
> Date: Sat, 8 Sep 2018 18:48:48 +0200
> Subject: [PATCH 1/2] services: nginx: Don't read PID file when passed a custom
>  config file.
>
> Fixes <https://bugs.gnu.org/XXX>.
>
> * gnu/services/web.scm (nginx-shepherd-service): Check whether FILE is
> true and don't read the PID file if it is; use 'read-pid-file' instead
> of a potentially endless loop.
> ---
>  gnu/services/web.scm | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/gnu/services/web.scm b/gnu/services/web.scm
> index 3778efd04..1c993b29f 100644
> --- a/gnu/services/web.scm
> +++ b/gnu/services/web.scm
> @@ -610,14 +610,12 @@ of index files."
>                   (match '#$args
>                     (("-s" . _) #t)
>                     (_
> -                    (let loop ((duration 0))
> -                      ;; https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864/comments/7
> -                      (sleep duration)
> -                      (if (file-exists? #$pid-file)
> -                          (let ((pid (call-with-input-file #$pid-file read)))
> -                            ;; it could be #<eof>
> -                            (if (integer? pid) pid (loop 1)))
> -                          (loop 1)))))))))
> +                    ;; When FILE is true, we cannot be sure that PID-FILE will
> +                    ;; be created, so assume it won't show up.  When FILE is
> +                    ;; false, read PID-FILE.
> +                    #$(if file
> +                          #~#t
> +                          #~(read-pid-file #$pid-file))))))))
>  
>       ;; TODO: Add 'reload' action.
>       (list (shepherd-service
> -- 
> 2.18.0
>
> From 211a820dbd37926f07f9245ab42cbaf6fb0264bb Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo <at> gnu.org>
> Date: Sat, 8 Sep 2018 18:50:55 +0200
> Subject: [PATCH 2/2] services: nginx: 'stop' returns #f.
>
> Previously we'd return #t, which the Shepherd would consider a failure
> to stop the service.
>
> * gnu/services/web.scm (nginx-shepherd-service): In 'nginx-action',
> return #f when stopping the service.
> ---
>  gnu/services/web.scm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gnu/services/web.scm b/gnu/services/web.scm
> index 1c993b29f..df82a6de6 100644
> --- a/gnu/services/web.scm
> +++ b/gnu/services/web.scm
> @@ -608,7 +608,7 @@ of index files."
>                                 (default-nginx-config config))
>                           #$@args)
>                   (match '#$args
> -                   (("-s" . _) #t)
> +                   (("-s" . _) #f)
>                     (_
>                      ;; When FILE is true, we cannot be sure that PID-FILE will
>                      ;; be created, so assume it won't show up.  When FILE is





Severity set to 'important' from 'normal' Request was from ludo <at> gnu.org (Ludovic Courtès) to control <at> debbugs.gnu.org. (Sat, 08 Sep 2018 20:33:01 GMT) Full text and rfc822 format available.

Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Sat, 08 Sep 2018 21:04:02 GMT) Full text and rfc822 format available.

Notification sent to ludo <at> gnu.org (Ludovic Courtès):
bug acknowledged by developer. (Sat, 08 Sep 2018 21:04:02 GMT) Full text and rfc822 format available.

Message #15 received at 32665-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: rekado <at> elephly.net, 32665-done <at> debbugs.gnu.org
Subject: Re: bug#32665: Shepherd is stuck waiting for /var/run/nginx/pid
Date: Sat, 08 Sep 2018 23:03:21 +0200
Hello,

Clément Lassieur <clement <at> lassieur.org> skribis:

> Oh!  Sorry for the mess.  The patches both look good to me, thank you!

Alright, pushed as 985975ae80fe5a8e58319b3a5aaf14da940c4419.

Thanks for the quick reply!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Oct 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 203 days ago.

Previous Next


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