NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.9k stars 1.53k forks source link

Nix GC cannot delete a path because it is in use #11923

Open picnoir opened 5 days ago

picnoir commented 5 days ago

Describe the bug

I recently faced a bug that I assume is coming from the topoSortPaths function where the GC was trying to delete a path having some alive referrers. The GC run service was constantly failing with the error message:

error: cannot delete path '/nix/store/r1lp9kxlrc6h7vrba90gm6i94s31xvvx-gnugrep-3.11' because it is in use by '/nix/store/911x30h15lbfg5fkkabzjhars2svbnaa-stdenv-linux'

I resolved this by manually deleting the faulty path referrers using nix-store --query --referrers and nix store delete. I sadly can't reproduce this bug. It seems to happen extremely infrequently.

Steps To Reproduce

I can't reproduce the issue

Expected behavior

The GC garbage collects all the referrers before GC-ing a path.

nix-env --version output

Additional context

Add any other context about the problem here.

Priorities

Add :+1: to issues you find important.