unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Konrad Hinsen <konrad.hinsen@fastmail.net>
Cc: guix-devel@gnu.org
Subject: Re: Increasing the timeout for shepherd services
Date: Thu, 11 Jul 2019 17:23:30 +0200	[thread overview]
Message-ID: <87r26wvbm5.fsf@gnu.org> (raw)
In-Reply-To: <m1lfxf9vqr.fsf@khs-macbook.home> (Konrad Hinsen's message of "Wed, 03 Jul 2019 13:57:00 +0200")

[-- Attachment #1: Type: text/plain, Size: 1208 bytes --]

Hi Konrad,

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

> When running Guix in a docker image, I get systematic failures for
> starting several services: syslogd, nscd, openssh. It turns out that in
> all these cases the daemons are started, but so slowly that shepherd
> declares a failure before they are fully operational.
>
> I managed to fix this for syslogd by setting #:pid-file-timeout to 30
> s. But I don't see a similar parameter for nscd and openssh, and
> moreover it seems more reasonable to increase the timeout for all
> services. Is this possible? I didn't find anything in the Shepherd
> manual.

‘read-pid-file’ in the Shepherd has a hard-coded default value of 5
seconds.  You can change it for each service, but there’s currently no
way to change the default value globally.

The patch below adds a SRFI-39 parameter in the Shepherd that would
allow you to change the default PID file delay globally.

Then, on the Guix side, we could provide a configuration option
“somewhere” (where?) to set that.  Or, you could simply add a Shepherd
service that modifies that value before any other service is started.

Thoughts?

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 973 bytes --]

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index bd7e379..8e7f625 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -74,6 +74,7 @@
             make-kill-destructor
             exec-command
             fork+exec-command
+            pid-file-default-delay
             read-pid-file
             make-system-constructor
             make-system-destructor
@@ -712,7 +713,12 @@ results."
 set when starting a service."
   (environ))
 
-(define* (read-pid-file file #:key (max-delay 5)
+(define pid-file-default-delay
+  ;; The default number of seconds for which 'read-pid-file' waits for PID
+  ;; files to show up.
+  (make-parameter 5))
+
+(define* (read-pid-file file #:key (max-delay (pid-file-default-delay))
                         (validate-pid? #f))
   "Wait for MAX-DELAY seconds for FILE to show up, and read its content as a
 number.  Return #f if FILE was not created or does not contain a number;

  reply	other threads:[~2019-07-11 15:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03 11:57 Increasing the timeout for shepherd services Konrad Hinsen
2019-07-11 15:23 ` Ludovic Courtès [this message]
2019-07-11 18:38   ` Konrad Hinsen

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87r26wvbm5.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).