unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 74279@debbugs.gnu.org
Subject: bug#74279: Shepherd service is not getting respawned.
Date: Sun, 10 Nov 2024 12:32:48 +0100	[thread overview]
Message-ID: <87zfm7wcgv.fsf@gnu.org> (raw)
In-Reply-To: <87bjyo8net.fsf@wolfsden.cz> (Tomas Volf's message of "Sat, 09 Nov 2024 15:58:02 +0100")

Hi Tomas,

Tomas Volf <~@wolfsden.cz> skribis:

>         (start #~(lambda _
>                    (let* ((cmd "/run/privileged/bin/ping -qc1 -W1 1.1.1.1")
>                           (status (system cmd)))
>                      (= 0 (status:exit-val status)))))
>         (one-shot? #t)
>         ;; Try every second.
>         (respawn-delay 1)
>         ;; Retry forever.  Double-quoting is intentional.
>         (respawn-limit ''(5 . 5)))))

[...]

> Nov  7 00:18:20 localhost shepherd[1]: Starting service network-online...
> [..]
> Nov  7 00:18:20 localhost shepherd[1]: [sh] PING 192.168.0.110 (192.168.0.110): 56 data bytes
> Nov  7 00:18:20 localhost shepherd[1]: [sh] /run/privileged/bin/ping: sending packet: Network is unreachable
> Nov  7 00:18:20 localhost shepherd[1]: Service network-online could not be started.
> Nov  7 00:18:20 localhost shepherd[1]: Service network-online failed to start.

I think there’s a misunderstanding here: ‘respawn?’ is about respawning
a service that, once it is running, terminates prematurely.

In your case, the service does not start (its ‘start’ method returns
#f).

Now, it would probably make sense to have a mechanism to retry starting
services.

In the specific case of ‘network-online’ though, you could use a
different approach: the ‘start’ method could itself try retry pinging
the network several times and fail only if it failed to reach the
network after, say, 10s.  (Remember that ‘start’ and ‘stop’ must
complete in a timely fashion.)

HTH,
Ludo’.




      reply	other threads:[~2024-11-10 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-09 14:58 bug#74279: Shepherd service is not getting respawned Tomas Volf
2024-11-10 11:32 ` Ludovic Courtès [this message]

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=87zfm7wcgv.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=74279@debbugs.gnu.org \
    /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).