Suppose you run a bunch of clients, ‘guix shell’, ‘guix build’, whatever. For each of these connections, guix-daemon creates a child process to handle it. (You can see them as “SessionPID” in the output of ‘guix processes’.)
‘herd stop guix-daemon’ won’t stop these guix-daemon child processes, only the parent process. This is because those sub-processes put themselves in a separate process group by calling ‘setsid’ (see ‘daemonLoop’ in ‘nix-daemon.cc’); shepherd terminates the whole process group, but that group contains nothing but the parent guix-daemon process. I traced back this ‘setsid’ call to 2006 in Nix (Nix commit 0130ef88ea280e67037fa76bcedc59db17d9a8ca), but there’s no justification. I would be tempted to just remove that ‘setsid’ call, but I wonder if there’s something subtle I’m overlooking. Thoughts? Ludo’.