From 43325669df9d038b7d407b6276e87e8a5d86e4df Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Mon, 22 Sep 2025 19:49:31 +0200 Subject: [PATCH] daemon: let subdaemons outlive their parent again In 7b37d5ea6aaa057fe53ca8ab54151327816ba026, aside from subdaemons getting properly executed, they also lost the ability to outlive their parent, due to now getting set the parent death signal like most other processes spawned by Lix. This has annoying consequences like all concurrent builds being forcefully terminated on system updates requiring a nix-daemon restart. As the behaviour change was not documented and the systemd service file retained `KillMode=process`, it seems to have been accidental. Restore the old behaviour of letting the subdaemons outlive their parent. Change-Id: I6a6a69645312a90dbce55495c2fef3825dd3c097 --- lix/libutil/processes.cc | 4 +++- lix/libutil/processes.hh | 1 + lix/nix/daemon.cc | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lix/libutil/processes.cc b/lix/libutil/processes.cc index 1809a3019..17483d951 100644 --- a/lix/libutil/processes.cc +++ b/lix/libutil/processes.cc @@ -319,7 +319,9 @@ RunningProgram runProgram2(const RunOptions & options) Pipe out; if (options.captureStdout) out.create(); - ProcessOptions processOptions; + ProcessOptions processOptions { + .dieWithParent = options.dieWithParent, + }; std::optional>> resumeLoggerDefer; if (options.isInteractive) { diff --git a/lix/libutil/processes.hh b/lix/libutil/processes.hh index 7a5fae3d8..f3a193b76 100644 --- a/lix/libutil/processes.hh +++ b/lix/libutil/processes.hh @@ -94,6 +94,7 @@ struct RunOptions std::optional gid = {}; std::optional chdir = {}; std::optional> environment = {}; + bool dieWithParent = true; bool captureStdout = false; bool isInteractive = false; std::vector redirections; diff --git a/lix/nix/daemon.cc b/lix/nix/daemon.cc index fc3ebe528..65db2a8f9 100644 --- a/lix/nix/daemon.cc +++ b/lix/nix/daemon.cc @@ -358,6 +358,7 @@ try { "--log-level", fmt("%1%", int(verbosity)), }, + .dieWithParent = false, .redirections = { {.dup = SUBDAEMON_CONNECTION_FD, .from = remote.get()},