daemon: let subdaemons outlive their parent again

In 7b37d5ea6a, 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
This commit is contained in:
Alois Wohlschlager
2025-09-22 19:51:58 +02:00
parent f68233ec43
commit 43325669df
3 changed files with 5 additions and 1 deletions
+3 -1
View File
@@ -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<Finally<std::function<void()>>> resumeLoggerDefer;
if (options.isInteractive) {
+1
View File
@@ -94,6 +94,7 @@ struct RunOptions
std::optional<uid_t> gid = {};
std::optional<Path> chdir = {};
std::optional<std::map<std::string, std::string>> environment = {};
bool dieWithParent = true;
bool captureStdout = false;
bool isInteractive = false;
std::vector<Redirection> redirections;
+1
View File
@@ -358,6 +358,7 @@ try {
"--log-level",
fmt("%1%", int(verbosity)),
},
.dieWithParent = false,
.redirections =
{
{.dup = SUBDAEMON_CONNECTION_FD, .from = remote.get()},