unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Brian Cully via Bug reports for GNU Guix <bug-guix@gnu.org>
To: Attila Lendvai <attila@lendvai.name>
Cc: guix-devel@gnu.org, "Ludovic Courtès" <ludo@gnu.org>,
	53580@debbugs.gnu.org
Subject: bug#53580: shepherd's architecture
Date: Mon, 29 May 2023 10:46:31 -0400	[thread overview]
Message-ID: <87fs7fxjut.fsf@psyduck.jhoto.kublai.com> (raw)
In-Reply-To: <Fe3OtPtYH2PHkXerCVPLsOIdvUw04jv5hYL_lms1t-V-JQ8vTvdHyu7Lk-PYfYIBns96NX34wxf8Yb3uNiiPGQzOMjB2hO7_yn3lrILV6fA=@lendvai.name>


Attila Lendvai <attila@lendvai.name> writes:

> it doesn't seem to be an insurmontable task to make sure that 
> guile
> can safely unlink a module from its heap, check if there are any
> references into the module to be dropped, and then reload this 
> module
> from disk.
>
> the already runing fibers would keep the required code in the 
> heap
> until after they are stopped/restarted. then the module would 
> get GC'd
> eventually.
>
> this would help solve the problem that a reconfigured service 
> may have
> a completely different start/stop code. and by taking some 
> careful
> shortcuts we may be able to make reloading work without having 
> to stop
> the service process in question.

Erlang has had hot code reloading for decades, built around the 
needs of 100% uptime systems. The problem is more complex than it 
often appears to people who are used to how lisps traditionally do 
it. I strongly recommend reading up on Erlang's migration 
system. Briefly: you can't just swap out function definitions, 
because they rely on non-function state which needs to be migrated 
along with the function itself, and you can't do it whenever you 
want, because external actors may be relying on a view of the 
internal state. To accomplish this, Erlang has a lot of machinery, 
and it fits in to the core design of the language and runtime 
which would be extremely difficult to port over to non-Erlang 
languages. Doing it in Scheme is probably possible in an academic 
sense, but not in a practical one.

OTOH, Lisp Flavoured Erlang exists if you want that syntax. There 
would definitely be advantages to writing an init (and, indeed, 
any service that needs 100% uptime) on top of the Erlang virtual 
machine. But going the other way, by porting Erlang's 
functionality into Scheme, is going to be a wash.

> in this setup most of the complexity and the evolution of the 
> shepherd
> codebase would happen in the runner, and the other two parts 
> could be
> kept minimal and would rarely need to change (and thus require a
> reboot).

Accepting that dramatic enough changes to PID 1 are going to 
require a reboot seems reasonable to me. They should be even more 
rare than kernel updates, and we accept rebooting there already.

-bjc




  parent reply	other threads:[~2023-05-29 15:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 11:32 bug#53580: /var/run/shepherd/socket is missing on an otherwise functional system Attila Lendvai
2022-01-27 12:13 ` bug#53580: (No Subject) Attila Lendvai
2022-02-01 11:06   ` Efraim Flashner
2022-02-01 19:28 ` bug#53580: /var/run/shepherd/socket is missing on an otherwise functional system Maxime Devos
2022-04-04  7:15   ` Attila Lendvai
2023-05-18 20:12 ` Ludovic Courtès
2023-05-27 10:33 ` bug#53580: shepherd's architecture Attila Lendvai
     [not found]   ` <Fe3OtPtYH2PHkXerCVPLsOIdvUw04jv5hYL_lms1t-V-JQ8vTvdHyu7Lk-PYfYIBns96NX34wxf8Yb3uNiiPGQzOMjB2hO7_yn3lrILV6fA=@lendvai.name>
2023-05-29 14:46     ` Brian Cully via Bug reports for GNU Guix [this message]
2023-06-06 15:16   ` Ludovic Courtès
2023-06-08 12:54     ` Csepp
2023-06-08 20:56     ` Attila Lendvai
2023-06-11 14:16       ` bug#53580: /var/run/shepherd/socket is missing on an otherwise functional system Ludovic Courtès
2023-06-11 14:18 ` Ludovic Courtès

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=87fs7fxjut.fsf@psyduck.jhoto.kublai.com \
    --to=bug-guix@gnu.org \
    --cc=53580@debbugs.gnu.org \
    --cc=attila@lendvai.name \
    --cc=bjc@spork.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@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).