unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Increasing the timeout for shepherd services
@ 2019-07-03 11:57 Konrad Hinsen
  2019-07-11 15:23 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Konrad Hinsen @ 2019-07-03 11:57 UTC (permalink / raw)
  To: guix-devel

Hi everyone,

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.

Konrad.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Increasing the timeout for shepherd services
  2019-07-03 11:57 Increasing the timeout for shepherd services Konrad Hinsen
@ 2019-07-11 15:23 ` Ludovic Courtès
  2019-07-11 18:38   ` Konrad Hinsen
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2019-07-11 15:23 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: guix-devel

[-- 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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Increasing the timeout for shepherd services
  2019-07-11 15:23 ` Ludovic Courtès
@ 2019-07-11 18:38   ` Konrad Hinsen
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Hinsen @ 2019-07-11 18:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Hi Ludo,

> ‘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.

That's what I did: change it for each service.

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

That sounds useful. Beyond my immediate problem, it seems weird to
hard-code a delay in the Shepherd source code.

Konrad.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-11 18:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 11:57 Increasing the timeout for shepherd services Konrad Hinsen
2019-07-11 15:23 ` Ludovic Courtès
2019-07-11 18:38   ` Konrad Hinsen

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).