forked from lix-project/lix
nix-daemon: Call exit(), not _exit()
This was preventing destructors from running. In particular, it was
preventing the deletion of the temproot file for each worker
process. It may also have been responsible for the excessive WAL
growth on Hydra (due to the SQLite database not being closed
properly).
Apparently broken by accident in
8e9140cfde
.
This commit is contained in:
parent
1256ab3b44
commit
a3e5c99d66
|
@ -864,7 +864,7 @@ void killUser(uid_t uid)
|
||||||
|
|
||||||
|
|
||||||
pid_t startProcess(std::function<void()> fun,
|
pid_t startProcess(std::function<void()> fun,
|
||||||
bool dieWithParent, const string & errorPrefix)
|
bool dieWithParent, const string & errorPrefix, bool runExitHandlers)
|
||||||
{
|
{
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid == -1) throw SysError("unable to fork");
|
if (pid == -1) throw SysError("unable to fork");
|
||||||
|
@ -883,6 +883,9 @@ pid_t startProcess(std::function<void()> fun,
|
||||||
std::cerr << errorPrefix << e.what() << "\n";
|
std::cerr << errorPrefix << e.what() << "\n";
|
||||||
} catch (...) { }
|
} catch (...) { }
|
||||||
} catch (...) { }
|
} catch (...) { }
|
||||||
|
if (runExitHandlers)
|
||||||
|
exit(1);
|
||||||
|
else
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ void killUser(uid_t uid);
|
||||||
/* Fork a process that runs the given function, and return the child
|
/* Fork a process that runs the given function, and return the child
|
||||||
pid to the caller. */
|
pid to the caller. */
|
||||||
pid_t startProcess(std::function<void()> fun, bool dieWithParent = true,
|
pid_t startProcess(std::function<void()> fun, bool dieWithParent = true,
|
||||||
const string & errorPrefix = "error: ");
|
const string & errorPrefix = "error: ", bool runExitHandlers = false);
|
||||||
|
|
||||||
|
|
||||||
/* Run a program and return its stdout in a string (i.e., like the
|
/* Run a program and return its stdout in a string (i.e., like the
|
||||||
|
|
|
@ -820,8 +820,8 @@ static void daemonLoop(char * * argv)
|
||||||
to.fd = remote;
|
to.fd = remote;
|
||||||
processConnection(trusted);
|
processConnection(trusted);
|
||||||
|
|
||||||
_exit(0);
|
exit(0);
|
||||||
}, false, "unexpected Nix daemon error: ");
|
}, false, "unexpected Nix daemon error: ", true);
|
||||||
|
|
||||||
} catch (Interrupted & e) {
|
} catch (Interrupted & e) {
|
||||||
throw;
|
throw;
|
||||||
|
|
Loading…
Reference in a new issue