gc: resume GC after a pathinuse error #11922
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
invalidatePathChecked
is throwing aPathInUse
exception. This exception is not catched and fails the whole GC run.Instead, I think we should log the error for the specific store path we're trying to delete, explaining we can't delete this path because it still has referrers. Once we're done with logging that, the GC run should continue to delete the dead store paths it can delete.
Context
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 messageI resolved this by manually deleting the faulty path referrers using
nix-store --query --referrers
andnix store delete
. I sadly can't reproduce this bug. It seems to happen extremely infrequently.This bug alone is not a massive deal due to its infrequent nature. However, the way it cascades is a serious issue for Nix builders. Because we're throwing an un-catched
PathInUse
exception, the full GC run fails. This prevents any automatic garbage collection of the nix store, and the machine disk is slowly but surely filling up. Up until the point where a manual intervention is required to fix the situation.Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.