[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
295/376: nix-daemon: Call exit(), not _exit()
From: |
Ludovic Courtès |
Subject: |
295/376: nix-daemon: Call exit(), not _exit() |
Date: |
Wed, 28 Jan 2015 22:05:43 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit a3e5c99d66e111455c6ddc40759005718016c8dd
Author: Eelco Dolstra <address@hidden>
Date: Wed Nov 19 17:09:27 2014 +0100
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
8e9140cfdef9dbd1eb61e4c75c91d452ab5e4a74.
---
src/libutil/util.cc | 7 +++++--
src/libutil/util.hh | 2 +-
src/nix-daemon/nix-daemon.cc | 4 ++--
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 99d2b1e..305e470 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -864,7 +864,7 @@ void killUser(uid_t uid)
pid_t startProcess(std::function<void()> fun,
- bool dieWithParent, const string & errorPrefix)
+ bool dieWithParent, const string & errorPrefix, bool runExitHandlers)
{
pid_t pid = fork();
if (pid == -1) throw SysError("unable to fork");
@@ -883,7 +883,10 @@ pid_t startProcess(std::function<void()> fun,
std::cerr << errorPrefix << e.what() << "\n";
} catch (...) { }
} catch (...) { }
- _exit(1);
+ if (runExitHandlers)
+ exit(1);
+ else
+ _exit(1);
}
return pid;
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index b35e02d..628b8a0 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -270,7 +270,7 @@ void killUser(uid_t uid);
/* Fork a process that runs the given function, and return the child
pid to the caller. */
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
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index d973e57..3864ab9 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -820,8 +820,8 @@ static void daemonLoop(char * * argv)
to.fd = remote;
processConnection(trusted);
- _exit(0);
- }, false, "unexpected Nix daemon error: ");
+ exit(0);
+ }, false, "unexpected Nix daemon error: ", true);
} catch (Interrupted & e) {
throw;
- 369/376: Bla, (continued)
- 369/376: Bla, Ludovic Courtès, 2015/01/28
- 294/376: Clean up temp roots in a more C++ way, Ludovic Courtès, 2015/01/28
- 287/376: Don't use ADDR_LIMIT_3GB, Ludovic Courtès, 2015/01/28
- 255/376: binary download: Use $NIX_CURL_FLAGS, Ludovic Courtès, 2015/01/28
- 301/376: 'build-cache-failures' -> 'build-cache-failure' in nix.conf documentation., Ludovic Courtès, 2015/01/28
- 275/376: Revert "Revert "Revert "Temporarily disable darwin builds while hydra's darwin is borked""", Ludovic Courtès, 2015/01/28
- 302/376: Don't claim FreeBSD support, Ludovic Courtès, 2015/01/28
- 274/376: Don't pull in git when doing a nix-shell, Ludovic Courtès, 2015/01/28
- 247/376: mkList: Scrub better, Ludovic Courtès, 2015/01/28
- 248/376: Improved error message when encountering unsupported file types, Ludovic Courtès, 2015/01/28
- 295/376: nix-daemon: Call exit(), not _exit(),
Ludovic Courtès <=
- 242/376: Add primop ‘attrValues’, Ludovic Courtès, 2015/01/28
- 254/376: nix-store -q: Check for conflicting flags, Ludovic Courtès, 2015/01/28
- 265/376: Merge pull request #380 from shlevy/temp-disable-darwin, Ludovic Courtès, 2015/01/28
- 253/376: nix-channel: Add --rollback flag, Ludovic Courtès, 2015/01/28
- 289/376: Document functors, Ludovic Courtès, 2015/01/28
- 259/376: Export realiseContext in libnixexpr, Ludovic Courtès, 2015/01/28
- 284/376: SSH.pm: Print a friendlier message if connecting fails, Ludovic Courtès, 2015/01/28
- 278/376: Typo, Ludovic Courtès, 2015/01/28
- 292/376: Add a test for the binary tarball installer, Ludovic Courtès, 2015/01/28
- 296/376: Disable vacuuming the DB after garbage collection, Ludovic Courtès, 2015/01/28