[Nix-dev] Concurrent garbage collection

Shea Levy shea at shealevy.com
Wed Oct 1 04:52:49 CEST 2014


Check out https://github.com/NixOS/nix/blob/master/src/libstore/gc.cc,
particularly addTempRoot (which is called by nix before any new nix path
is written or considered valid) and openGCLock.

The answer to "what happens" is that invariants are preserved, though
possibly at the cost of a long wait.

~Shea

On Wed, Oct 01, 2014 at 01:58:33AM +0100, Vincent Laporte wrote:
> Hi,
> 
> Out of curiosity, I wonder what happens if the garbage collection
> (nix-collect-garbage) is run while some other process builds a package
> (nix-build or nix-env -i), both operating on the same store at the same
> time.
> 
> In particular, the collector may remove a path that is a dependency of a
> package being built. How do you address this issue?
> 
> Thanks,
> --
> Vincent.
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list