[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
114/118: nix-daemon: Call exit(), not _exit()
From: |
Ludovic Courtès |
Subject: |
114/118: nix-daemon: Call exit(), not _exit() |
Date: |
Tue, 19 May 2015 14:46:06 +0000 |
civodul pushed a commit to branch nix
in repository guix.
commit 4eb62b5230c29e2f6ab17352439521083846c259
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.
---
nix/libutil/util.cc | 8 ++++++--
nix/libutil/util.hh | 3 ++-
nix/nix-daemon/nix-daemon.cc | 4 ++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index ad3b3c3..a4a1ddb 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -858,7 +858,8 @@ void killUser(uid_t uid)
//////////////////////////////////////////////////////////////////////
-pid_t startProcess(std::function<void()> fun, const string & errorPrefix)
+pid_t startProcess(std::function<void()> fun,
+ bool dieWithParent, const string & errorPrefix, bool runExitHandlers)
{
pid_t pid = fork();
if (pid == -1) throw SysError("unable to fork");
@@ -873,7 +874,10 @@ pid_t startProcess(std::function<void()> fun, const string
& errorPrefix)
std::cerr << errorPrefix << e.what() << "\n";
} catch (...) { }
} catch (...) { }
- _exit(1);
+ if (runExitHandlers)
+ exit(1);
+ else
+ _exit(1);
}
return pid;
diff --git a/nix/libutil/util.hh b/nix/libutil/util.hh
index 418d76d..0ad0026 100644
--- a/nix/libutil/util.hh
+++ b/nix/libutil/util.hh
@@ -269,7 +269,8 @@ 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, const string & errorPrefix =
"error: ");
+pid_t startProcess(std::function<void()> fun, bool dieWithParent = true,
+ const string & errorPrefix = "error: ", bool runExitHandlers = false);
/* Run a program and return its stdout in a string (i.e., like the
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 2fa3632..e42d602 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -924,8 +924,8 @@ static void daemonLoop()
to.fd = remote;
processConnection(trusted);
- _exit(0);
- }, "unexpected Nix daemon error: ");
+ exit(0);
+ }, false, "unexpected Nix daemon error: ", true);
} catch (Interrupted & e) {
throw;
- 94/118: Doh, (continued)
- 94/118: Doh, Ludovic Courtès, 2015/05/19
- 96/118: fix disappearing bash arguments, Ludovic Courtès, 2015/05/19
- 104/118: createDirs(): Handle ‘path’ being a symlink, Ludovic Courtès, 2015/05/19
- 103/118: nix-daemon: Close unnecessary fd, Ludovic Courtès, 2015/05/19
- 97/118: Introduce allowedRequisites feature, Ludovic Courtès, 2015/05/19
- 113/118: Clean up temp roots in a more C++ way, Ludovic Courtès, 2015/05/19
- 105/118: Remove some duplicate code, Ludovic Courtès, 2015/05/19
- 108/118: Improve error message if the daemon worker fails to start, Ludovic Courtès, 2015/05/19
- 100/118: Settings: Add bool get(), Ludovic Courtès, 2015/05/19
- 106/118: Improved error message when encountering unsupported file types, Ludovic Courtès, 2015/05/19
- 114/118: nix-daemon: Call exit(), not _exit(),
Ludovic Courtès <=
- 99/118: Add an 'optimiseStore' remote procedure call., Ludovic Courtès, 2015/05/19
- 107/118: Fix build on gcc < 4.7, Ludovic Courtès, 2015/05/19
- 98/118: Add disallowedReferences / disallowedRequisites, Ludovic Courtès, 2015/05/19
- 110/118: Make ~DerivationGoal more reliable, Ludovic Courtès, 2015/05/19
- 111/118: Don't use ADDR_LIMIT_3GB, Ludovic Courtès, 2015/05/19
- 115/118: Disable vacuuming the DB after garbage collection, Ludovic Courtès, 2015/05/19
- 117/118: Build derivations in a more predictable order, Ludovic Courtès, 2015/05/19
- 109/118: nix-store --gc: Don't warn about missing manifests directory, Ludovic Courtès, 2015/05/19
- 118/118: Don't wait for PID -1, Ludovic Courtès, 2015/05/19
- 112/118: Fix message, Ludovic Courtès, 2015/05/19