GNU bug report logs -
#63190
[Shepherd] Nested calls lead to a hang
Previous Next
Reported by: Bruno Victal <mirai <at> makinata.eu>
Date: Sun, 30 Apr 2023 15:22:01 UTC
Severity: normal
Tags: notabug
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 63190 <at> debbugs.gnu.org (full text, mbox):
Hi,
Bruno Victal <mirai <at> makinata.eu> skribis:
> Original discussion (IRC): <https://logs.guix.gnu.org/guix/2023-04-29.log#180735>
[...]
> (procedure
> #~(lambda (x)
> ;; Scenario 1: using code from (gnu services herd), this hangs shepherd
> #;(start-service 'dummy) ; hangs shepherd
(gnu services herd) provides a client to talk to the shepherd process.
However, the code of actions runs in the shepherd process itself, so
there’s no need to use the client library. Don’t do that. :-)
(Whether that leads to a deadlock depends; at first sight, I’d say
there’s no reason for this to deadlock in general, but you can of course
end up with a logic bug like A starts B, which spawns a client to start
A, which doesn’t start because it’s waiting for B.)
> ;; Scenario 2: this doesn't hang shepherd but do note that the service has to be re-enabled either manually or automatically here
> #;(system* #$(file-append shepherd "/bin/herd") "start" "dummy-service")
This is equivalent to the one above.
> ;; Scenario 3: use the already imported (shepherd service) module, doesn't hang shepherd
> ;; Like Scenario 2, the service must be re-enabled since (respawn? #f) disabled this.
> ;; Comment: Won't re-enabling mean that this service will relaunch once it quits?
> ;; That means the service has to disable itself on a successful exit, perhaps within the (stop ...) field?
> (start 'dummy-service))))))))
This should work without blocking.
However, starting a service from another one doesn’t sound great.
Could you give more context?
Thanks,
Ludo’.
This bug report was last modified 2 years and 71 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.