From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlo Zancanaro Subject: Re: Improving Shepherd Date: Mon, 05 Feb 2018 21:49:08 +1100 Message-ID: <877errn23f.fsf@zancanaro.id.au> References: <871si8bc5g.fsf@zancanaro.id.au> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eieKx-0002iY-SJ for guix-devel@gnu.org; Mon, 05 Feb 2018 05:49:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eieKt-0000Yk-JS for guix-devel@gnu.org; Mon, 05 Feb 2018 05:49:23 -0500 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:36523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eieKt-0000Wh-Ck for guix-devel@gnu.org; Mon, 05 Feb 2018 05:49:19 -0500 Received: by mail-wm0-x22c.google.com with SMTP id f3so24967722wmc.1 for ; Mon, 05 Feb 2018 02:49:19 -0800 (PST) Received: from pidgey (tmo-103-64.customers.d1-online.com. [80.187.103.64]) by smtp.gmail.com with ESMTPSA id 188sm10957467wmg.29.2018.02.05.02.49.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Feb 2018 02:49:16 -0800 (PST) In-reply-to: <871si8bc5g.fsf@zancanaro.id.au> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --=-=-= Content-Type: text/plain; format=flowed A few people came to join me on Friday to think about Shepherd. Thanks Alex, Efraim, and Jelle. We talked about a few different things that we'd like to achieve with Shepherd. The most significant and achievable things were, I think: user services, child process control, and concurrency/parallelism. User services - Alex has already sent a patch to the list to allow generating user services from the Guix side. The idea is to generate a Shepherd config file, allowing a user to invoke shepherd manually to start their services. A further extension to this would be to have something like systemd's "user sessions", where the pid 1 Shepherd automatically starts a user's services when they log in. Child process control - this is my personal frustration, where Shepherd loses track of processes that fork away (e.g. "emacs --daemon"). I barely know anything about Linux process management, but from my reading this can be solved through Linux namespaces (if user namespaces are available). Could someone who knows more about this let me know if that's a productive direction for me to investigate? Or tell me a better way to go about it? Concurrency/parallelism - I think Jelle was planning to work on this, but I might be wrong about that. Maybe I volunteered? We're keen to see Shepherd starting services in parallel, where possible. This will require some changes to the way we start/stop services (because at the moment we just send a "start" signal to a single service to start it, which makes it hard to be parallel), and will require us to actually build some sort of real dependency resolution. Longer-term our goal should be to bring fibers into Shepherd, but Efraim mentioned that fibers doesn't compile on ARM at the moment, so we'll have to get that working first at least. I mentioned an idea to the guys on Friday about how Shepherd should treat enabled/disabled services. I've thought about it some more, and I think it might work. The general idea is that Shepherd would always try to run an enabled service, and it would leave a disabled service as-is (unless it's needed to start another service). So it would kind of work like this: - if stopped and enabled: try to start service - if started and enabled: monitor, and restart service if it fails - if retrying too often: disable this service, and all which depend on it - else: only start if another enabled service depends on this one This would mean that Shepherd could decide the best way to start/stop services, including doing so in parallel if possible. So, there are our ideas! Any thoughts, or words of wisdom? Feedback is welcome. Carlo On Mon, Jan 29 2018, Carlo Zancanaro wrote: > I'm keen to do some work on shepherd. Partially this is driven > by > me using it to manage my user session and having it not always > work right, and partially this is driven by me grepping the code > for "FIXME" (which was slightly overwhelming). If anyone is keen > to chat about it on Friday, please find me! I have some ideas > about things I'd like to do, but I don't really have any idea > what > I'm doing. Any help/advice/encouragement you can give me will be > appreciated! > > Carlo --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlp4NqQACgkQqdyPv9aw Ibx0wQ/7BqBwE0p2KXpkQ2ePhlnvJGFYpTCKaptuK1adTBlG6PK9xHBbZilT+Yaa nBPP7Id9E3Thrn23J/Uym/CvoX1ggYgNdV5JVXtPOQxeB2O5Q5QbBq5PE18x7A+8 YtoARujXlwca3vi+M9OPFrTmh+0rBWsTJuQ8l5RuM5ZEVHOZz8iw7czq5SkePbAy LLoJb1mkIUTf8rhtG7+j8ckFC1PqVUGBE/14edZn5U9ifVGDFTgI0gW8nGKL8aEm 2n/UmDrviz9T3IyYyEc+In2jQFG3teXX9NWb6OAOmCIDUj7+G8yqhgauLC7Eyor8 ZWa0DNaSqseCqDOyyUhkM7XeTSEal9U6AZQkYKorquorRzi1bx06voLBOZe/4Q85 bnlyRg0kFV2ANJiH2VPEGAfh6a6aoiQ0ZR+mmklctdCU9r7YSn85Uhe4GUwjAea8 bthck2/RVgMlwFMXJMwy/+YAXcHHUEOEmKe5z0hnBw0EIuUPA1i14tTa3kuQxZuM iAnDqoqX/+NpWRDlNM0j3SAx0rOQlYAUQ/zTpjhoxQZjWnHnSF4+OLG0Q/bX5Il7 GN7WWzQwPPR4ddJw/oBX8On8pQ6/T89jMQE+2htNK8zNrLxkTZEML0QQLX60zQDN TL8WxpPDEIdGBvuB723QnYLqPuLoV86te5N40vBYpqRyowBy0ac= =CCva -----END PGP SIGNATURE----- --=-=-=--