[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Increasing the timeout for shepherd services
From: |
Ludovic Courtès |
Subject: |
Re: Increasing the timeout for shepherd services |
Date: |
Thu, 11 Jul 2019 17:23:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Hi Konrad,
Konrad Hinsen <address@hidden> 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’.
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;