about summary refs log tree commit diff
path: root/src/libstore/gc.cc
AgeCommit message (Collapse)AuthorFilesLines
2019-08-29 Don't rely on st_blocksEelco Dolstra1-4/+3
It doesn't seem very reliable on ZFS.
2019-08-29 CleanupEelco Dolstra1-2/+2
2019-08-02 SimplifyEelco Dolstra1-18/+14
With BSD locks we don't have to guard against reading our own temproots.
2019-08-02 Use BSD instead of POSIX file locksEelco Dolstra1-2/+2
POSIX file locks are essentially incompatible with multithreading. BSD locks have much saner semantics. We need this now that there can be multiple concurrent LocalStore::buildPaths() invocations.
2019-08-02 Add a test for auto-GCEelco Dolstra1-2/+7
This currently fails because we're using POSIX file locks. So when the garbage collector opens and closes its own temproots file, it causes the lock to be released and then deleted by another GC instance.
2019-07-30 Disable findRuntimeRoots on darwin when running tests because lsof is slowBas van Dijk1-10/+15
See: https://github.com/NixOS/nix/issues/3011
2019-04-30 findRootsNoTemp: fixes comment about findRuntimeRootsSamuel Dionne-Riel1-4/+3
The NIX_ROOT_FINDER environment variable was removed in 3c46fe62b833a4e66845665edc99555022d3d98c when porting from perl to C.
2019-03-14 findRoots(): Add 'censor' parameterEelco Dolstra1-12/+18
This is less brittle than filtering paths after the fact in nix-daemon.
2019-03-14 findRuntimeRoots: Simplify/fix handling of /proc filesEelco Dolstra1-14/+12
Scanning of /proc/<pid>/{exe,cwd} was broken because '{memory:' was prepended twice. Also, get rid of the whole '{memory:...}' thing because it's unnecessary, we can just list the file in /proc directly.
2019-03-10 Unify internal findRootsXxx() apiGuillaume Maudoux1-22/+13
2019-03-10 Make roots a map of store paths to pinning linksGuillaume Maudoux1-21/+18
This new structure makes more sense as there may be many sources rooting the same store path. Many profiles can reference the same path but this is even more true with /proc/<pid>/maps where distinct pids can and often do map the same store path. This implementation is also more efficient as the `Roots` map contains only one entry per rooted store path.
2019-03-10 Obfuscate memory roots for non-root usersGuillaume Maudoux1-7/+7
2019-03-10 detail memory rootsGuillaume Maudoux1-30/+31
2018-06-18 Merge pull request #2234 from symphorien/esrch2Eelco Dolstra1-1/+1
libstore/gc.cc: ignore ESRCH when reading symlinks in /proc
2018-06-16 libstore/gc.cc: ignore ESRCH when reading symlinks in /procSymphorien Gibol1-1/+1
readlink is also affected by the problem fixed for regular files in c567afe355df
2018-06-13 std::random_shuffle -> std::shuffleEelco Dolstra1-1/+3
The former is removed in C++17.
2018-06-11 libstore/gc.cc: ignore ESRCH when reading /procSymphorien Gibol1-10/+13
If a process disappears between the time /proc/[pid]/maps is opened and the time it is read, the read() syscall will return ESRCH. This should be ignored.
2018-03-06 rand() -> random(), since we use srandom().Will Dietz1-1/+1
rand() requires we call srand() instead, but might as well use random().
2018-02-01 Remove obsolete references to manifestsEelco Dolstra1-3/+1
Closes #323.
2017-09-14 Show the pid of temporary rootsEelco Dolstra1-10/+15
2017-09-14 nix-store -q --roots / --gc --print-roots: Print temporary / in-memory rootsEelco Dolstra1-20/+37
For example, $ nix-store -q --roots /nix/store/7phd2sav7068nivgvmj2vpm3v47fd27l-patchelf-0.8pre845_0315148 {temp:1} denotes that the path is only being kept alive by a temporary root (i.e. /nix/var/nix/temproots/). Similarly, $ nix-store --gc --print-roots ... {memory:9} -> /nix/store/094gpjn9f15ip17wzxhma4r51nvsj17p-curl-7.53.1 shows that curl is being used by some process.
2017-09-06 Fix abort when the GC thread gets an exceptionEelco Dolstra1-13/+21
2017-09-05 Add automatic garbage collectionEelco Dolstra1-0/+70
Nix can now automatically run the garbage collector during builds or while adding paths to the store. The option "min-free = <bytes>" specifies that Nix should run the garbage collector whenever free space in the Nix store drops below <bytes>. It will then delete garbage until "max-free" bytes are available. Garbage collection during builds is asynchronous; running builds are not paused and new builds are not blocked. However, there also is a synchronous GC run prior to the first build/substitution. Currently, no old GC roots are deleted (as in "nix-collect-garbage -d").
2017-09-05 GC: Don't delete own temproots fileEelco Dolstra1-30/+27
Since file locks are per-process rather than per-file-descriptor, the garbage collector would always acquire a lock on its own temproots file and conclude that it's stale.
2017-08-31 Rename a few configuration optionsEelco Dolstra1-5/+5
In particular, drop the "build-" and "gc-" prefixes which are pointless. So now you can say nix build --no-sandbox instead of nix build --no-build-use-sandbox
2017-07-30 Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim1-36/+36
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-04 Support base-64 hashesEelco Dolstra1-1/+1
Also simplify the Hash API. Fixes #1437.
2017-05-16 Improve progress indicatorEelco Dolstra1-1/+1
2017-04-24 Remove debug statementEelco Dolstra1-1/+0
2017-04-20 Detect lsofEelco Dolstra1-3/+8
Also, don't use lsof on Linux since it's not needed. Fixes #1328.
2017-04-10 Minor cleanupEelco Dolstra1-1/+1
Also, possible fix for #1310 on 32-bit systems.
2017-01-16 AutoCloseDir: Use std::unique_ptrEelco Dolstra1-8/+8
2016-12-08 Don't delete .check directories of running buildsEelco Dolstra1-0/+5
We need to keep them around for diffoscope.
2016-11-26 Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra1-38/+38
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25 Get rid of unicode quotes (#1140)Guillaume Maudoux1-38/+38
2016-09-21 printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra1-18/+18
2016-07-21 find-runtime-roots: fold into gc.ccShea Levy1-8/+108
2016-07-11 Modernize AutoCloseFDShea Levy1-17/+17
2016-06-09 Use O_CLOEXEC in most placesEelco Dolstra1-3/+2
2016-06-02 LocalStore: Allow the physical and logical store directories to differEelco Dolstra1-19/+20
This is primarily to subsume the functionality of the copy-from-other-stores substituter. For example, in the NixOS installer, we can now do (assuming we're in the target chroot, and the Nix store of the installation CD is bind-mounted on /tmp/nix): $ nix-build ... --option substituters 'local?state=/tmp/nix/var&real=/tmp/nix/store' However, unlike copy-from-other-stores, this also allows write access to such a store. One application might be fetching substitutes for /nix/store in a situation where the user doesn't have sufficient privileges to create /nix, e.g.: $ NIX_REMOTE="local?state=/home/alice/nix/var&real=/home/alice/nix/store" nix-build ...
2016-06-02 Allow setting the state directory as a store parameterEelco Dolstra1-19/+15
E.g. "local?store=/tmp/store&state=/tmp/var".
2016-06-01 Make the store directory a member variable of StoreEelco Dolstra1-8/+8
2016-05-04 More GC fixesEelco Dolstra1-5/+5
2016-04-25 Fix "path is not in the Nix store" during GCEelco Dolstra1-1/+1
2016-04-25 Improved logging abstractionEelco Dolstra1-1/+1
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.
2016-04-21 Fix test failuresEelco Dolstra1-1/+1
2016-04-19 Move path info caching from BinaryCacheStore to StoreEelco Dolstra1-2/+2
Caching path info is generally useful. For instance, it speeds up "nix path-info -rS /run/current-system" (i.e. showing the closure sizes of all paths in the closure of the current system) from 5.6s to 0.15s. This also eliminates some APIs like Store::queryDeriver() and Store::queryReferences().
2016-04-08 Make LocalStore thread-safeEelco Dolstra1-15/+16
Necessary for multi-threaded commands like "nix verify-paths".
2016-02-24 deletePath(): Succeed if path doesn't existEelco Dolstra1-1/+1
Also makes it robust against concurrent deletions.
2016-02-24 Eliminate reserveSpace flagEelco Dolstra1-0/+3