GNU bug report logs - #77373
[shepherd] Deadlock between service-controller and service-builtin-logger

Previous Next

Package: guix;

Reported by: nathan <nathan_mail <at> nborghese.com>

Date: Sat, 29 Mar 2025 23:42:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: nathan <nathan_mail <at> nborghese.com>
To: 77373 <at> debbugs.gnu.org
Subject: bug#77373: [shepherd] Deadlock between service-controller and service-builtin-logger
Date: Sat, 29 Mar 2025 23:41:24 +0000
I definitely have a deadlock problem with Shepherd and I do believe I've found it.
shepherd 1.0.3

This is in service-controller when the service has been stopped:
(when logger
  (put-message logger 'terminate))
But in service-builtin-logger, this is called every time a line is read:
(or pid
    (and service
         (eq? 'running (service-status service))
         (match (service-running-value service)
           ((? process? process)
            (process-id process))
           (value
            value))))

service-status -> service-control-message -> put-message to the service
The fibers documentation says put-message is blocking. Surely this is a deadlock.

The value of `pid' can be cached and we might avoid the deadlock.
But this happens ONLY if a line of output is read while the service is 'running.
If output only comes while the service is 'starting/'stopping, we will keep calling service-status.

Potential fix:
At the time spawn-service-builtin-logger is called in fork+exec-command, we already know the pid.
Maybe just prepend the pid to the `command' argument if you want it to appear in the log output.





This bug report was last modified 100 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.