nix-collect-garbage stops collecting when path cannot be deleted #621

Closed
opened 2025-01-10 00:28:35 +00:00 by mweinelt · 2 comments
Member

Describe the bug

When nix-collect-garbage comes upon a path that is still in use the gc cycle ends prematurely.

nix-gc-start[935934]: deleting '/nix/store/mw6pdidcz4i1nv4jxp5j4d9y1hnfzp92-system-path'
nix-gc-start[935934]: deleting '/nix/store/6qa8a8jzhxk8akz20q8mrvcmivlvfilk-dbus-1'
nix-gc-start[935934]: deleting '/nix/store/6nz12d7m4lhyakgjlgdhj0r4n0xac2j6-X-Restart-Triggers-polkit'
nix-gc-start[935934]: deleting '/nix/store/6nx4hxsf9y62azlizq3hlns7v2b4315p-unit-dbus.service'
nix-gc-start[935934]: error: cannot delete path '/nix/store/6nqq0c7ydiyszdn3nbq6w3vv3mlr7ik5-closure-info' because it is in use by '/nix/store/g637xdzj482gb73r48snlqg90y3qqn48-run-nixos-vm'
nix-gc-start[935934]: 1906 store paths deleted, 4405.96 MiB freed
systemd[1]: nix-gc.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: nix-gc.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Nix Garbage Collector.
systemd[1]: nix-gc.service: Consumed 41.046s CPU time, 72.8M memory peak, 17.1M read from disk.

Steps To Reproduce

  1. Run a very active builder
  2. Regularly run garbage collection
  3. Wait until nix-gc.service fails

Expected behavior

If a path cannot be deleted, the gc cycle should continue.

nix --version output

nix (Lix, like Nix) 2.91.1

Additional context

https://github.com/NixOS/nix/issues/11923
https://github.com/NixOS/nix/pull/11922

## Describe the bug When nix-collect-garbage comes upon a path that is still in use the gc cycle ends prematurely. ``` nix-gc-start[935934]: deleting '/nix/store/mw6pdidcz4i1nv4jxp5j4d9y1hnfzp92-system-path' nix-gc-start[935934]: deleting '/nix/store/6qa8a8jzhxk8akz20q8mrvcmivlvfilk-dbus-1' nix-gc-start[935934]: deleting '/nix/store/6nz12d7m4lhyakgjlgdhj0r4n0xac2j6-X-Restart-Triggers-polkit' nix-gc-start[935934]: deleting '/nix/store/6nx4hxsf9y62azlizq3hlns7v2b4315p-unit-dbus.service' nix-gc-start[935934]: error: cannot delete path '/nix/store/6nqq0c7ydiyszdn3nbq6w3vv3mlr7ik5-closure-info' because it is in use by '/nix/store/g637xdzj482gb73r48snlqg90y3qqn48-run-nixos-vm' nix-gc-start[935934]: 1906 store paths deleted, 4405.96 MiB freed systemd[1]: nix-gc.service: Main process exited, code=exited, status=1/FAILURE systemd[1]: nix-gc.service: Failed with result 'exit-code'. systemd[1]: Failed to start Nix Garbage Collector. systemd[1]: nix-gc.service: Consumed 41.046s CPU time, 72.8M memory peak, 17.1M read from disk. ``` ## Steps To Reproduce 1. Run a very active builder 2. Regularly run garbage collection 3. Wait until `nix-gc.service` fails ## Expected behavior If a path cannot be deleted, the gc cycle should continue. ## `nix --version` output nix (Lix, like Nix) 2.91.1 ## Additional context https://github.com/NixOS/nix/issues/11923 https://github.com/NixOS/nix/pull/11922
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2387 ("fix(gc): log sudden "path in use" exceptions and recover during GC gracefully")
  • commit message in cl/2415 ("fix(gc): log sudden "path in use" exceptions and recover during GC gracefully")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2387", "number": 2387, "kind": "commit message"}, {"backlink": "https://gerrit.lix.systems/c/lix/+/2415", "number": 2415, "kind": "commit message"}], "cl_meta": {"2387": {"change_title": "fix(gc): log sudden \"path in use\" exceptions and recover during GC gracefully"}, "2415": {"change_title": "fix(gc): log sudden \"path in use\" exceptions and recover during GC gracefully"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2387](https://gerrit.lix.systems/c/lix/+/2387) ("fix(gc): log sudden "path in use" exceptions and recover during GC gracefully") * commit message in [cl/2415](https://gerrit.lix.systems/c/lix/+/2415) ("fix(gc): log sudden "path in use" exceptions and recover during GC gracefully")
Owner

fixed, right?

fixed, right?
jade closed this issue 2025-02-08 03:09:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#621
No description provided.