Subject: Re: bug#63982: Shepherd can crash when a user service fails to start

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 12 Jun 2023 13:32:18 -0400

Hi Ludovic!

Ludovic Courtès <[email-masked]> writes:

> Hi Maxim,
>
> Maxim Cournoyer <[email-masked]> skribis:
>
>> rm /run/user/1000/shepherd/socket
>>
>> $ /gnu/store/y826g8wrpzskcs82ffxppj7mmz257ksi-shepherd-0.10.1/bin/shepherd
>> Starting service root...
>> Service root started.
>> Service root running with value #t.
>> Service root has been started.
>> WARNING: Use of `load' in declarative module (#{ g119}#).  Add #:declarative? #f to your define-module invocation.
>>
>> Some deprecated features have been used.  Set the environment
>> variable GUILE_WARN_DEPRECATED to "detailed" and rerun the
>> program to get more information.  Set it to "no" to suppress
>> this message.
>> Starting service gpg-agent...
>>
>> $ herd status
>> herd: error: /run/user/1000/shepherd/socket: No such file or directory
>
> Thanks for the detailed bug report!
>
> I believe this is fixed by Shepherd commit
> 24c964021ebd3d63ce6e22808dd09dbe16116a6c, which introduces an additional
> change: loading the config file asynchronously.

Nitpick: I'd use a git message tag for 'Reported-by', as can be inserted
in the commit buffer in Magit with C-c C-p.  They should be placed at
the bottom of the git message to be considered by tools parsing them.

> If you wish to test it, you can use the ‘shepherd’ channel.

I've done so by placing in my ~/.config/guix/channels.scm file:

       (channel
        (name 'shepherd)
        (url "https://git.savannah.gnu.org/git/shepherd.git")
        (introduction
         (make-channel-introduction
          "788a6d6f1d5c170db68aa4bbfb77024fdc468ed3"  ;2022-05-21
          (openpgp-fingerprint
           "3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5"))))

It'd be nice to have this in the Shepherd doc for easy copy & paste.

> Let me know how it goes!

I've edited my ~/.xsession file to use
/gnu/store/ahzl8vxxcd5bqlljwgn8wkp4884sr72l-shepherd-0.10.99-tarball,
and I'm now seeing this:

--8<---------------cut here---------------start------------->8---
$ herd status
Démarrés :
 + root
Starting:
 ^ emacs
Arrêtés :
 - gpg-agent
 - ibus-daemon
 - jackd
 - workrave
--8<---------------cut here---------------end--------------->8---
 
Interestingly, the Emacs client is usable.  It doesn't change from
there, and requesting it to be stopped hangs Shepherd:

--8<---------------cut here---------------start------------->8---
$ herd stop emacs

--8<---------------cut here---------------end--------------->8---

If I comment out the Emacs service from the ~/.config/shepherd/init.scm
file, the same seems to happen on my next service, gpg-agent:

--8<---------------cut here---------------start------------->8---
$ herd status
Démarrés :
 + root
Starting:
 ^ gpg-agent
Arrêtés :
 - emacs
 - ibus-daemon
 - jackd
 - workrave
--8<---------------cut here---------------end--------------->8---

Etc. if I comment that one (now hanging on starting ibus-daemon).  It
seems something is still off?

Thanks for working toward a fix!

-- 
Thanks,
Maxim